mongodb - Not able to find a document When I insert a Ensure index query -


  1. i create document db.duplicate.ensureindex ({"a": 1}, {"unique": "true"})
  2. to create unique index on a
  3. when search document don't find value (db.duplicate.find())
  4. 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

Popular posts from this blog

Listboxes in c# -

Excel Duty List -

Multilayer CSV to filtered excel -