Skip to main content

Using the Mongo Shell

  • Chapter
Pro MongoDB™ Development
  • 1843 Accesses

Abstract

The MongoDB data storage structures are similar to those of a SQL relational database. A MongoDB database is similar to an SQL database. A table in an SQL database is a collection in MongoDB. A row in an SQL database is a document in MongoDB. A column in an SQL database is a field in MongoDB. MongoDB distribution includes an interactive shell called the Mongo shell. The Mongo shell provides database commands of different kinds including aggregation commands (for example, the count command finds the number of documents in a collection), collection commands (for example, the create command creates a collection), and administration commands (for example, the copydb command copies a database instance). The Mongo shell provides various JavaScript Mongo shell helper methods for data operations and administration. Some of the database commands have the equivalent Mongo shell helper methods, while others don’t. In this chapter we shall discuss how to access the Mongo shell and run database commands and JavaScript helper methods on a database, collection, or document.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 34.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 44.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Deepak Vohra

About this chapter

Cite this chapter

Vohra, D. (2015). Using the Mongo Shell. In: Pro MongoDB™ Development. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-1598-2_2

Download citation

Publish with us

Policies and ethics