mongodb - check for multiple attributes existence -
i know how o check if document has attribute:
db.things.find({otherinfo:{'$exists':true}});
if want check if more 1 attribute exist ?
the $exists method not special. checks documents have field specified. can use use other operator in mongodb.
if need check multiple attributes, need add them query:
db.things.find({ otherinfo: { $exists: true }, foo: { $exists: true }, bar: { $exists: true }, : 123, b : 234 /* ... */ });
Comments
Post a Comment