MongoDB CRUD Operation

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • insert(document or array of documents)
  • insertOne( 'document', { writeConcern: 'document' } )
  • insertMany( { [ document 1 , document 2, ... ] }, { writeConcern: document, ordered: boolean } )
  • find(query, projection)
  • findOne(query, projection)
  • update(query, update)
  • updateOne( query, update, { upsert: boolean, writeConcern: document } )
  • updateMany( query, update, { upsert: boolean, writeConcern: document } )
  • replaceOne( query, replacement, { upsert: boolean, writeConcern: document } )
  • remove(query, justOne)
  • findAndModify(query, sort, update, options[optional])

Remarks

Updating and Deleting a document should be done carefully. Since operation may affect for multiple documents.



Got any MongoDB Question?