-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Labels
Description
Tested with https://github.com/codepunkt/mongoose-patch-history#b9d8abde29d0b1df5137f8c4565a73069aeff3d0
Perhaps this cannot be supported and should be mentioned in the README?
it('with findOneAndUpdate upsert', (done) => {
Post.findOneAndUpdate(
{ title: 'findOneAndUpdateUpsert' },
{ $set: { title: 'findOneAndUpdateUpsert' } },
{
new: true,
upsert: true,
setDefaultsOnInsert: true,
runValidators: true
}
)
.lean()
.then((post) =>
post.patches
.find({ ref: post._id })
.sort({ _id: 1 })
.then((patches) => {
assert.equal(patches.length, 1)
})
)
.then(done)
.catch(done)
})