This version of the documentation is archived and no longer supported.
  • Reference >
  • mongo Shell JavaScript Quick Reference

mongo Shell JavaScript Quick Reference

Administrative Functions

Collection Methods

These methods operate on collection objects. Also consider the “Query and Update Methods” and “Cursor Methods” documentation for additional methods that you may use with collection objects.


Call these methods on a collection object in the shell (i.e. db.collection.[method](), where collection is the name of the collection) to produce the documented behavior.

Native Shell Methods

These methods provide a number of low level and internal functions that may be useful in the context of some advanced operations in the shell. The JavaScript standard library is accessible in the mongo shell.

Non-User Functions and Methods

Native Methods

Internal Methods

These methods are accessible in the shell but exist to support other functionality in the environment. Do not call these methods directly.

  • _startMongoProgram()
  • clearRawMongoProgramOutput()
  • copyDbpath()
  • rawMongoProgramOutput()
  • resetDbpath()
  • run()
  • runMongoProgram()
  • runProgram()
  • stopMongoProgram()
  • stopMongoProgramByPid()
  • stopMongod()
  • waitMongoProgramOnPort()
  • waitProgram()