mongodb - Not able to find a document When I insert a Ensure index query -
- i create document
db.duplicate.ensureindex ({"a": 1}, {"unique": "true"})
- to create unique index on
a
- when search document don't find value (
db.duplicate.find()
) - ideally should create document
_id & = 1
? approach right?
the ensureindex
function creates index collection, not document. increase performance when querying documents a
index.
for creating documents, try insert:
db.duplicate.insert({'a': 1})
Comments
Post a Comment