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
{{ message }}
Repository navigation
DeprecationWarning raised when using a find options string #308
collection.find({}, 'name' ) raises a DeprecationWarning. I see #303/#304 fixed documentation by suggesting shifting to projection, rather than fields. This will no doubt work, but the documentation changes do not appear to fully reflect reality when using an options string.
users.findOne({name: 'foo'},'name').then((doc)=>{// only the name projection will be selected});
Using monk 7.3.0, as expected findOne with fields raises a DeprecationWarning:
> collection.find({name: 'Test'}, { fields: { 'name': 1 } } );
> (node:125878) DeprecationWarning: collection.find option [fields] is deprecated and will be removed in a later version.
However, findOne appears to continue to parse an options string as fields, not projection as it raises an unexpected DeprecationWarning:
> collection.findOne({name: 'Test'}, 'name' );
> (node:126116) DeprecationWarning: collection.find option [fields] is deprecated and will be removed in a later version.
The same behaviour is experienced with find.
Is the options string expansion to fields done within monk or within mongodb? Either way, the problem should be fixed or the documentation updated to reflect reality.
This also affects the code in README.md which references passing options as a string.
Activity