Stats

54 Contributors: 2 Tuesday, September 27, 2016
Licensed under: CC-BY-SA
Not affiliated with Stack Overflow
Rip Tutorial: riptutorial@gmail.com
Roadmap: roadmap

Mongodb integration

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)

Related Examples