Syntax

Database Commands

Show Databases

show dbs

Switch to Database

use database_name

Show Current Database

db

Collection Commands

// Show collections in current database
show collections

// Create collection
db.createCollection("collection_name")

// Drop collection
db.collection_name.drop()

Insert Syntax

Find Syntax

Update Syntax

Delete Syntax

Comparison Operators

Logical Operators

Element Operators

Evaluation Operators

Field Update Operators

Array Update Operators

Basic Pipeline Structure

Common Pipeline Stages

Arithmetic Operators

String Operators

Date Operators

Create Index

Index Management

Create User

User Operations

List Users

Update User

Delete User

Connection String Syntax

Basic Connection

With Authentication

With Options

Replica Set

Shell Commands Syntax

Show Current Database

Show Collections

Clear Screen

Exit Shell

Help

Show Stats

Print Formatted JSON

Print to Console

Load JavaScript File

Executed JavaScript

Last updated