MongoDB - Sparse Index
//
We can create indexes on a collection's fields but what happens when we are creating an index and that key is not present more then one document in that collection.
Suppose we have a collection with following documents
1. a:1, b:2, c:3
2. a:1, b:2
3. a:1, b:2
If we create an index on c then for document 1 it will be ok but for document 2 and 3 c's value will be
c=null (c= null) will be in both 2 and 3 documents, but unique means that a key will have unique value for each document so DB will not create a unique index for this collection .
Read More about it from the following link : http://coding-guru.com/mongodb-sparse-index/ posted by Maz
MongoDB - Sparse Index
Tags:
0 comments: