Start a new topic

How to query nested _acl items in a collection?


collectionAccess.collection('keyprefs').find({"_acl.creator":userfound._id}, function (err, foundkeyarr)

does not find elements with an _acl.creator that matches userfound._id.
1 Comment

Hi James,

The code in your example is the correct way to query for nested items. However, depending on how you retrieve the "userfound" entity, it is possible that its id is of type ObjectId rather than a string. Since the "creator" field holds a string, try passing in a string version of the id:

collectionAccess.collection('keyprefs').find({"_acl.creator":userfound._id.toString()}, function (err, foundkeyarr) { ... });
Login or Signup to post a comment