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 have searched existing issues to ensure the bug has not already been reported
Mongoose version
6.9.1
Node.js version
16.x
MongoDB server version
Any
Typescript version (if applicable)
No response
Description
The following script shows that Mongoose sends projection: {} to the MongoDB driver, which is unnecessary. Would be ideal if Mongoose didn't set a projection option if the projection is empty.
'use strict';constmongoose=require('mongoose');mongoose.set('debug',true);run().catch(err=>console.log(err));asyncfunctionrun(){awaitmongoose.connect('mongodb://localhost:27017/test');constschema=newmongoose.Schema({name: String});constTest=mongoose.model('Test',schema);// Prints "Mongoose: tests.findOne({}, { projection: {} })"awaitTest.findOne();// Sends `projection: {}` to MongoDB}
Steps to Reproduce
See above
Expected Behavior
No response
The text was updated successfully, but these errors were encountered:
Prerequisites
Mongoose version
6.9.1
Node.js version
16.x
MongoDB server version
Any
Typescript version (if applicable)
No response
Description
The following script shows that Mongoose sends
projection: {}
to the MongoDB driver, which is unnecessary. Would be ideal if Mongoose didn't set aprojection
option if the projection is empty.Steps to Reproduce
See above
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: