mongodb - Mongo DB find() query error -


i new mongodb. have collection called person. i'm trying records without _id field query:

db.person.find({}{_id:0}) 

but error

syntax error: unexpected {

but if write

db.person.find() 

it works perfectly.

consider following documents inserted in person collection

db.person.insert({"name":"abc"}) db.person.insert({"name":"xyz"} 

if want find exact matching use query

db.person.find({"name":"abc"}) 

this return matched name documents

if want names without _id use projeciton id query

db.person.find({},{"_id":0}) 

which return

{ "name" : "abc" } { "name" : "xyz" } 

Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -