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
Post a Comment