monsgoose save code example
Example 1: mongoose save or update
// This will create another document if it doesn't exist
findByIdAndUpdate(_id, { something: 'updated' }, { upsert: true });
Example 2: node mongoose save document
// Example for a model called Person with two properties, e.g. name, surname
// Values to be saved
const person = { name: Jane, surname: Doe};
// you can access the _id property from savedPerson variable (savedPerson._id)
savedPerson = await new Person(person).save()