I have a collection named \"permissions\" on MongoDB. I want to implement a simple update like this:
let schema = new Schema({
title: String
});
let
According to the docs
Models are fancy constructors compiled from Schema definitions. An instance of a model is called a document. Models are responsible for creating and reading documents from the underlying MongoDB database.
So you need to create instance during the .save()
call only. Other operations(update, read, delete) applied on the existing document and hence, no need to create instance.