by Mark Nielsen
Copyright April 2023



Mongo Query Examples



NOTE: Not done yet

Links

  1. Mongo Cheat Sheet
  2. Mongo Methods
  3. Legacy Mongo 5.2 shell commands
  4. Current shell native commands
  5. Tutorials


Start mongosh

  1. Start your mongosh session.
  2. help commands
    Help Basic shell commands, non-json.
    db.help() Basic json commands.
    show.help Show commands, non-json.
    db.test.help() Basic document manipulation commands.


Document Queries

Save the file : mongo_queries.txt

Load the command into mongo, we assume you are connected to mongo and have downloaded "mongo_queries.txt".

Execute in mongo, and look at the file too.

load("mongo_queries.txt")
  


Transactions on Single MongoDD Server

Save the file : mongo_transaction.txt

Load the command into mongo, we assume you are connected to mongo and have downloaded "mongo_transactions.txt".

Execute in mongo, and look at the file too.

load("mongo_transactions.txt")
  


Accounts

Save the file : mongo_accounts.txt

Load the command into mongo, we assume you are connected to mongo and have downloaded "mongo_accounts.txt".

Execute in mongo, and look at the file too.

load("mongo_accounts.txt")
  
TODO: Read up on TLS, roles, and create user, and initial account.