We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
6.4.4
18.5
5.0.9
lean transform doesn't work
this.favoriteList .find({ }) .lean({ transform: (doc) => { delete doc._id; return doc; } });
No response
The text was updated successfully, but these errors were encountered:
Can you please show me what you expect the document to look like?
Sorry, something went wrong.
@IslandRhythms I expect to see this behavior, but in fact, _id is present
it('allows a transform option for lean on a query gh-10423', async function() { const testSchema = new mongoose.Schema({ name: String }); const Test = db.model('gh10423', testSchema); await Test.create({name: 'foo'}); const result = await Test.findOne().lean({ transform: (doc, ret) => { delete ret._id; return ret; }}); assert.equal(result._id, undefined); });
this example from 0044913
086bd9f
IslandRhythms
No branches or pull requests
Prerequisites
Mongoose version
6.4.4
Node.js version
18.5
MongoDB server version
5.0.9
Description
lean transform doesn't work
Steps to Reproduce
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: