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

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -