Hello all,I have a collection of objects that are like the example below named adminslocals{ "_id":"5c8ec7420472bc874c30632b", "hostname":"p51", "dateAdded":"2019-03-17T04:00:00.000Z", "adminCount":2, "admins":[ {"_id":"5c8ec7420472bc874c30632d","Name":"P51\\Administrator"},{"_id":"5c8ec7420472bc874c30632c","Name":"P51\\saiello"} ], "__v":0 } db.adminslocals.find({ hostname : /p/ }) will bring back the documenthowever if I use the following syntaxdb.adminslocals.find({ admins.Name : /P/ }) brings nothing back....also tried db.adminslocals.find({ "\`admins.Name``" : { $regex : "/Administrator/" }})` with no resultsDoes this syntax not work on an array? I'm new to Mongo, and I don't see much documentation on querying arrays of documents.Kind regards
Submitted March 19, 2019 at 03:41AM by sma92878
No comments:
Post a Comment