Saturday, 16 March 2019

selecting multiple documents where value is...

Hello all,​I'm trying to figure out how to do something similar in mongo to a WHERE statement in SQL:​SELECT computerName FROM ComputerList WHERE InstalledSoftware = 'Office'​If I have a collection of objects with the following properties:{ computerName: "computer1", InstalledSoftware: "MsOffice" }, { computerName: "computer2", InstalledSoftware: "OpenOffice" }, { computerName: "computer3", InstalledSoftware: "MsOffice" } ​I found this in the Mongo docs, but I don't fully understand the example:​db.foo.find( { $where: function() { return (hex_md5(this.name) == "9b53e667f30cd329dca1ec9e6a83e994") } } ); https://docs.mongodb.com/manual/reference/operator/query/where/​Is there a simple way to do this?​Thank you kindly

Submitted March 17, 2019 at 02:10AM by sma92878

No comments:

Post a Comment