[DOCS-10093] Comment on: "manual/core/index-sparse.txt" Created: 07/Apr/17 Updated: 27/Oct/23 Resolved: 11/Apr/17 |
|
| Status: | Closed |
| Project: | Documentation |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Docs Collector User (Inactive) | Assignee: | Kay Kim (Inactive) |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | collector-298ba4e7 | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Location: https://docs.mongodb.com/v2.4/core/index-sparse/#index-type-sparse |
||
| Participants: | |
| Days since reply: | 6 years, 44 weeks, 1 day ago |
| Description |
|
For mongodb v2.6 The example at the end of this page seems wrong. However, this index would not permit adding the following documents: db.scores.insert( { "userid": "PWWfO8lFs1", "score": 82 } ) ) It has different score values but it states that due to sparse index on score field these statements would not execute fine. |
| Comments |
| Comment by Kay Kim (Inactive) [ 11/Apr/17 ] |
|
The example refers to the collection that has: { "_id" : ObjectId("523b6e32fb408eea0eec2647"), "userid" : "newbie" } { "_id" : ObjectId("523b6e61fb408eea0eec2648"), "userid" : "abby", "score" : 82 } { "_id" : ObjectId("523b6e6ffb408eea0eec2649"), "userid" : "nina", "score" : 90 }As such, with the unique,sparse index, you cannot add new documents that contain the score 82 or 90: ) ) |