Doc #63183 [Asn->Csd]: the option 'sparse' is available for creating index

From: Date: Wed, 03 Oct 2012 21:37:23 +0000
Subject: Doc #63183 [Asn->Csd]: the option 'sparse' is available for creating index
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8929@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63183&edit=1 ID: 63183 Updated by: jmikola@php.net Reported by: baggio-sb81 at hotmail dot com Summary: the option 'sparse' is available for creating index -Status: Assigned +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: windows PHP Version: 5.3.17 Assigned To: jmikola Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. http://svn.php.net/viewvc?view=revision&revision=327869 Previous Comments: ------------------------------------------------------------------------ [2012-09-29 03:45:27] baggio-sb81 at hotmail dot com Description: ------------ --- From manual page: http://www.php.net/mongocollection.ensureindex#refsect1-mongocollection.ensureindex-parameters --- db->designComment->ensureIndex('reply.id', array('unique'=>1, 'sparse'=>1)) Test script: --------------- db->designComment->ensureIndex('reply.id', array('unique'=>1, 'sparse'=>1)) Expected result: ---------------- When more the one reply.ids are null. Using option array('unique'=>1) can not successfully ensureIndex. Actually, the mongo offer the 'sparse' option to work for this situation(http://docs.mongodb.org/manual/core/indexes/#synopsis) Cited from the above like "You can combine the sparse index option with the unique indexes option so that mongod will reject documents that have duplicate values for a field, but that ignore documents that do not have the key." And this option is already available in php, but the documentation does not list this option Actual result: -------------- {"v":1, "key":{"reply.id":1}, "unique":true, "ns":"XXXXX.designComment", "sparse":1, "name":"reply_id_1"} The above proves the 'sparse' option is available in php ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=63183&edit=1

« previous php.doc.bugs (#8929) next »