You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I might just be missing this in the code but I'm having some difficulty figuring out how to exclude subdocuments from a result. One of the collections I'm working with can have fairly extensive array of subdocuments and the unserialize() functionality takes a fair amount of resources. I've moved the functionality into an aggregate() function (which is awesome BTW) but I would like to omit retrieving those subdocuments from my normal queries so I don't have to bear with the overhead of unserialization.
The Collection::find() and Collection::findOne() methods take a projection option, which corresponds to the second argument in your example. This is equivalent to the projection option on the MongoDB\Driver\Query object in the underlying driver.
This will be properly documented in #144. To copy/paste an example from that PR:
I might just be missing this in the code but I'm having some difficulty figuring out how to exclude subdocuments from a result. One of the collections I'm working with can have fairly extensive array of subdocuments and the unserialize() functionality takes a fair amount of resources. I've moved the functionality into an aggregate() function (which is awesome BTW) but I would like to omit retrieving those subdocuments from my normal queries so I don't have to bear with the overhead of unserialization.
In the old MongoDB Collection I could specify
but I can't find how that can be accomplished with this library.
The text was updated successfully, but these errors were encountered: