Install the complete package with local command reference and every published mode.
install mongodbmongodbUse
mongodb [options] · mongodb : <json-command>mongodbshow the current
mongodb -c <host|uri> [user] [database] [-p <port>] [-n] [-m [name]]connect; password is requested separately when a user is supplied unless -n is used
-use <database>select another database
-llist databases
-tlist collections
-s <collection>show collection indexes
-n <collection> [documents]preview documents
-f <collection> <field> <value> [documents]find documents by one field
-o <collection> [file] [-f]export documents as JSON
-a <collection> : <json>insert one document
-w <collection> <field> <value> : <json>update matching documents
-d <collection> <field> <value>delete matching documents
-m [name]save the current connection in .lil.key; default name is the database
-M <name>remove a saved connection
-k [name]list saved connections or inspect one without showing its password
-K <name>connect using a saved connection
-edisconnect and clear connection data
mongodb : <json-command>execute a native database command document
mongodb dump [file.json] [-f]create an Extended JSON logical dump
mongodb load <file.json>restore a lil
-l lists databases, -t lists collections, -s lists indexes, -n previews documents and -f matches one field/value pair. -o exports a collection as JSON.
-a inserts a JSON document. -w applies $set to documents matching one field/value pair. -d deletes documents matching one field/value pair. Complex operations remain available through native command documents after :.
dump stores collections as canonical Extended JSON strings when the driver supports them, preserving BSON types better than ordinary JSON. load restores lil
-c accepts either a host or a full
Commands run with the privileges of the supplied
When a full
Without -m, connection data remains scoped to the current PHP session. -m [name] explicitly stores the current profile in the protected .lil.key file (0600), -K <name> reconnects from it, -k lists or inspects profiles without exposing a stored password, and -M <name> removes one. kill removes .lil.key together with the other core state. Treat the file as sensitive because an opted-in profile can contain database credentials.
Run the prepared examples directly on the page. Their results are prebuilt and shown in the browser; no terminal command is executed on the server.
Install the current compatible version. Choose Base for the complete feature set or Minimum for the reduced package; use upgrade to update a module that is already installed.
Base and Minimum are two packages of the same current module release, not separate command versions.
Install the complete package with local command reference and every published mode.
install mongodbInstall the reduced package. Local reference is omitted;
install mongodb -mInstall exactly this published version.
install mongodb -v 1.1.3Ask upgrade to check compatibility and replace the installed block only when needed.
upgrade mongodbRemove the extension block while leaving the core and unrelated modules intact.
install mongodb -uExamples are copyable command lines, not actions executed by this website. Review paths, permissions and destructive flags before running them on a real project.
mongodb -use shop | mongodb -t | mongodb -n products 5Database shop
products
orders
{"sku":"SHOE-1","name":"City shoe","category":"shoes","price":79.9}
{"sku":"BAG-1","name":"Canvas bag","category":"bags","price":44.5}mongodb -c localhost app shopStatus connected
Server localhost
Database shop
Version 8.xmongodb -c mongodb://localhost/shop -nStatus connected
Server localhost
Database shop
Version 8.xmongodb -ladmin
config
shopmongodb -s products_id_ {"_id":1}
sku_1 {"sku":1}mongodb -f products sku SHOE-1 20{"sku":"SHOE-1","name":"City shoe","price":79.9}mongodb -o products products.jsonSaved products.jsonmongodb -a products : {"sku":"BAG-1","name":"Travel bag","price":49.90}Inserted 1
ID generatedmongodb -w products sku BAG-1 : {"price":44.90}Matched 1
Updated 1mongodb -d products sku BAG-1Deleted 1mongodb : {"count":"products"}{"n":4,"ok":1}mongodb dump shop.jsonSaved shop.jsonmongodb load \sandbox\db\mongodb.jsonRestored 2mongodb -e+mongodb -s missing_collectionCollection not found: missing_collectionsandbox/db/mongodb.jsonThe example uses a file or directory from the protected /sandbox/ documentation workspace.
{
"format": "lil-mongodb-json",
"version": 1,
"database": "shop",
"created": "2026-08-09T00:00:00+00:00",
"collections": {
"products": [
"{\"sku\":\"SHOE-1\",\"name\":\"City shoe\",\"category\":\"shoes\",\"price\":79.9,\"active\":true}",
"{\"sku\":\"BAG-1\",\"name\":\"Canvas bag\",\"category\":\"bags\",\"price\":44.5,\"active\":true}"
]
}
}
Adds explicit -m/-M/-k/-K profiles in .lil.key; listings never reveal a stored password.