Mongoose - findOneAndUpdate not populating _id

Viewed 260

It seems that anywhere I do a findOneAndUpdate call that my item gets saved, but the _id field is not set.

The options I am using to insert into my empty collection are:

{
  upsert: true,
  setDefaultsOnInsert: true,
  strict: false,
  new: true,
  runValidators: true
}

Running on mongoose 4.11. When I turn the debug on in mongoose, I do not see _id in the $setOnInsert, or $set objects. am I missing something? I get the document back in the callback but _id is null. Noting in my super simple schema controls _id

Thanks!

0 Answers
Related