This is my model:
var UserSchema = new Schema({
username: { type: String, unique: true, index: true },
url: { type: String },
name: { type: Strin
See the examples in the findOneAndUpdate
documentation:
A.findOneAndUpdate(conditions, update, options, callback) // executes
A.findOneAndUpdate(conditions, update, options) // returns Query
A.findOneAndUpdate(conditions, update, callback) // executes
A.findOneAndUpdate(conditions, update) // returns Query
A.findOneAndUpdate() // returns Query
If you don't provide a callback, it returns a Query
object that you must call exec() on to execute the update.