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

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -