mongoose $set use code example
Example 1: mongoose connect
mongoose.connect('mongodb://localhost:27017/test', {
useMongoClient: true,
connectTimeoutMS: 1000
})
Example 2: mongoose save or update
// This will create another document if it doesn't exist
findByIdAndUpdate(_id, { something: 'updated' }, { upsert: true });