php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #63183 the option 'sparse' is available for creating index
Submitted: 2012-09-29 03:45 UTC Modified: 2012-10-03 21:37 UTC
From: baggio-sb81 at hotmail dot com Assigned: jmikola (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.3.17 OS: windows
Private report: No CVE-ID: None
 [2012-09-29 03:45 UTC] 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

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-10-01 22:02 UTC] derick@php.net
-Assigned To: +Assigned To: jmikola
 [2012-10-03 21:37 UTC] jmikola@php.net
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
 [2012-10-03 21:37 UTC] jmikola@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Mar 16 06:01:29 2025 UTC