javascript - Compund index which overwrites previous document -


I am trying to create a model for MongoDb to use Mongoos where I want to make sure that There is only one document present and file for a particular user.

  var filestama memory = new Mongoose Sema ({file: mongoose.Schema.Type.ObjectId, user: mojo.edema.type objectID, hasin: {type: boolean, default: while trying to save a document with a combination of file, file} and user A duplicate key error that precedes it is.  

Is there any way by which I can configure MongoDB to overwrite the document instead of raising an exception?

If the document is not present, then this command will create a new

  collection.update ({file: 2112, user: 21421}, {Hassin: true}, {upside down: true});  

Comments

Popular posts from this blog

HTML/CSS - Automatically set height width from background image? -

php - Mysql Show Process - Sleep Commands and what to do -

c - What is the address of buf (the local variable in the main function)? -