How get documents from MongoDB database with the condition that an array field has values more than 1
Solution:
db.collection.find({ $expr: { $gt: [ { $size: "$arrayfield" }, 1 ] } })
Try it out here: mongoplayground
Project Weekay | Resume | LinkedIn Profile
NodeJS, AWS, MongoDB, ReactJS, Django, Python, ML with Scikit Learn, Matplotlib, Seaborn
Engineering, UX, Marketing, Product Designing, Business
sayhellotovinit@gmail.com | +91 99239 08880 | Pune, India
Solution:
db.collection.find({ $expr: { $gt: [ { $size: "$arrayfield" }, 1 ] } })
Try it out here: mongoplayground
Comments
Post a Comment