Model.find method failed
Closed this issue · 4 comments
Is there an existing issue for this?
- I have searched the existing issues
Current behavior
this is pretty strange behaviour.
Not sure why MyModel.find().exec() adding projection like below. Here is db log
mymodel.find({}, { projection: {} })}}
throws an error
Failed to retrieve documents [replica set: frontenddev1]] Database error!
Stacktrace:
|_/ java.lang.Exception: [ccmIntelligence-dev.mymodel ....... Database error!
|____/ Mongo Server error (MongoQueryException): Query failed with error code 2 with name 'BadValue' and error message '>1 field in obj: {}' on <server host>:27017
why find method adding projection?
and with out projection it works. quite confusing.
Minimum reproduction code
cant provider organisation url
Steps to reproduce
No response
Expected behavior
should return documents. i am not sure why this has stopped working. I was using mac intel and recently moved to M1. However i tried on intel again. No luck.
Package version
9.2.0
mongoose version
No response
NestJS version
No response
Node.js version
16.x
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
No response
Most likely this isn't related to Nest. If you think this is a bug with @nestjs/mongoose
, please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).
If you believe so, please provide a minimum reproduction repository (Git repository/StackBlitz/CodeSandbox project).
Please, use our Discord channel (support) for such questions. We are using GitHub to track bugs, feature requests, and potential improvements.