Doc #63183 [NEW]: the option 'sparse' is available for creating index

From: Date: Sat, 29 Sep 2012 03:45:27 +0000
Subject: Doc #63183 [NEW]: the option 'sparse' is available for creating index
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8912@lists.php.net to get a copy of this message
From:             baggio-sb81 at hotmail dot com
Operating system: windows
PHP version:      5.3.17
Package:          Documentation problem
Bug Type:         Documentation Problem
Bug description:the option 'sparse' is available for creating index

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 bug report at https://bugs.php.net/bug.php?id=63183&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=63183&r=trysnapshot54
Try a snapshot (PHP 5.3):   https://bugs.php.net/fix.php?id=63183&r=trysnapshot53
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=63183&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63183&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63183&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63183&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63183&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63183&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63183&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63183&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=63183&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=63183&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63183&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63183&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63183&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63183&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63183&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63183&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63183&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63183&r=mysqlcfg



Thread (2 messages)

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