Node.js Mongodb integration

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 Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • db.collection.insertOne(document, options(w, wtimeout, j, serializeFuntions, forceServerObjectId, bypassDocumentValidation), callback)
  • db.collection.insertMany([documents], options(w, wtimeout, j, serializeFuntions, forceServerObjectId, bypassDocumentValidation), callback)
  • db.collection.find(query)
  • db.collection.updateOne(filter, update, options(upsert, w, wtimeout, j, bypassDocumentValidation), callback)
  • db.collection.updateMany(filter, update, options(upsert, w, wtimeout, j), callback)
  • db.collection.deleteOne(filter, options(upsert, w, wtimeout, j), callback)
  • db.collection.deleteMany(filter, options(upsert, w, wtimeout, j), callback)

Parameters

ParameterDetails
documentA javascript object representing a document
documentsAn array of documents
queryAn object defining a search query
filterAn object defining a search query
callbackFunction to be called when the operation is done
options(optional) Optional settings (default: null)
w(optional) The write concern
wtimeout(optional) The write concern timeout. (default: null)
j(optional) Specify a journal write concern (default: false)
upsert(optional) Update operation (default: false)
multi(optional) Update one/all documents (default: false)
serializeFunctions(optional) Serialize functions on any object (default: false)
forceServerObjectId(optional) Force server to assign _id values instead of driver (default: false)
bypassDocumentValidation(optional) Allow driver to bypass schema validation in MongoDB 3.2 or higher (default: false)


Got any Node.js Question?