Skip to content

Commit

Permalink
added test case
Browse files Browse the repository at this point in the history
  • Loading branch information
IslandRhythms committed May 13, 2022
1 parent 9aa10a5 commit 0044913
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/query.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3962,4 +3962,16 @@ describe('Query', function() {
assert.equal(result.length, 1);
assert.equal(result[0].name, '@foo.com');
});
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);
});
});

0 comments on commit 0044913

Please sign in to comment.