MongoDB
mongodb connectmongodb client_show_loadedmongodb client_existmongodb disconnectmongodb disconnect allmongodb database_showmongodb database_loadmongodb database_show_loadedmongodb database_existmongodb database_unloadmongodb database_unload allmongodb collection_showmongodb collection_loadmongodb collection_show_loadedmongodb collection_existmongodb collection_unloadmongodb collection_unload allmongodb collection_insertmongodb collection_updatemongodb collection_deletemongodb collection_selectmongodb database_stat
mongodb connect <url> <clientId>
Description
Connect to a database
Connect to a database
Parameters
url: The URL ("mongodb://localhost:27017") - string - required
clientId: The client id - string - required
url: The URL ("mongodb://localhost:27017") - string - required
clientId: The client id - string - required
admin
mongodb connect "mongodb://localhost:27017" "client1";
mentdb
1
mongodb client_show_loaded
Description
Show the loaded collections
Show the loaded collections
admin
mongodb client_show_loaded;
mentdb
["client1"]
mongodb client_exist <clientId>
Description
Check if MongoDB is already loaded
Check if MongoDB is already loaded
Parameters
clientId: The client id - string - required
clientId: The client id - string - required
admin
mongodb client_exist "client1";
mentdb
1
mongodb disconnect <clientId>
Description
Disconnect a MongoDB connection
Disconnect a MongoDB connection
Parameters
clientId: The client id - string - required
clientId: The client id - string - required
admin
mongodb disconnect "client1";
mentdb
1
mongodb disconnect all
Description
Disconnect all MongoDB connections
Disconnect all MongoDB connections
admin
mongodb disconnect all;
mentdb
1
mongodb database_show <clientId>
Description
Show all databases of a MongoDB server
Show all databases of a MongoDB server
Parameters
clientId: The client id - string - required
clientId: The client id - string - required
admin
mongodb database_show "client1";
mentdb
["admin","config","jim","local"]
mongodb database_load <clientId> <databaseId> <databaseName>
Description
Load a database into memory
Load a database into memory
Parameters
clientId: The client id - string - required
databaseId: The database id - string - required
databaseName: The database name - string - required
clientId: The client id - string - required
databaseId: The database id - string - required
databaseName: The database name - string - required
admin
mongodb database_load "client1" "database1" "jimdb";
mentdb
1
mongodb database_show_loaded
Description
Show the loaded collections
Show the loaded collections
admin
mongodb database_show_loaded;
mentdb
["database1"]
mongodb database_exist <databaseId>
Description
Check if a database is already loaded
Check if a database is already loaded
Parameters
databaseId: The database id - string - required
databaseId: The database id - string - required
admin
mongodb database_exist "database1";
mentdb
1
mongodb database_unload <databaseId>
Description
Unload a database from memory
Unload a database from memory
Parameters
databaseId: The database id - string - required
databaseId: The database id - string - required
admin
mongodb database_unload "database1";
mentdb
1
mongodb database_unload all
Description
Unload all databases from memory
Unload all databases from memory
admin
mongodb database_unload all;
mentdb
1
mongodb collection_show <databaseId>
Description
Show all collections of a database
Show all collections of a database
Parameters
databaseId: The database id - string - required
databaseId: The database id - string - required
admin
mongodb collection_show "database1";
mentdb
["collection_jim"]
mongodb collection_load <databaseId> <collectionId> <collectionName>
Description
Load a collection into memory
Load a collection into memory
Parameters
databaseId: The database id - string - required
collectionId: The collection id - string - required
collectionName: The collection name - string - required
databaseId: The database id - string - required
collectionId: The collection id - string - required
collectionName: The collection name - string - required
admin
mongodb collection_load "database1" "collection1" "jimcollection";
mentdb
1
mongodb collection_show_loaded
Description
Show the loaded collections
Show the loaded collections
admin
mongodb collection_show_loaded;
mentdb
["collection1"]
mongodb collection_exist <collectionId>
Description
Check if a collection is already loaded
Check if a collection is already loaded
Parameters
collectionId: The collection id - string - required
collectionId: The collection id - string - required
admin
mongodb collection_exist "collection1";
mentdb
1
mongodb collection_unload <collectionId>
Description
Unload a collection from memory
Unload a collection from memory
Parameters
collectionId: The collection id - string - required
collectionId: The collection id - string - required
admin
mongodb collection_unload "collection1";
mentdb
1
mongodb collection_unload all
Description
Unload all collections from memory
Unload all collections from memory
admin
mongodb collection_unload all;
mentdb
1
mongodb collection_insert <collectionId> <json>
Description
Insert a new element into a collection
Insert a new element into a collection
Parameters
collectionId: The collection id - string - required
json: The JSON to insert - string - required
collectionId: The collection id - string - required
json: The JSON to insert - string - required
admin
mongodb collection_insert "collection1" "{\"name\": \"payet\", \"age\": 40}";
mentdb
1
mongodb collection_update <collectionId> <jsonTarget> <jsonAction>
Description
Update elements of a collection
Update elements of a collection
Parameters
collectionId: The collection id - string - required
jsonTarget: The JSON that targets the elements - string - required
jsonAction: The JSON action to apply to the elements - string - required
collectionId: The collection id - string - required
jsonTarget: The JSON that targets the elements - string - required
jsonAction: The JSON action to apply to the elements - string - required
admin
mongodb collection_update "collection1" "{\"name\": \"jim\"}" "{\"$set\": {\"age\": 99}}";
mentdb
2
mongodb collection_delete <collectionId> <jsonWhere>
Description
Delete elements from a collection
Delete elements from a collection
Parameters
collectionId: The collection id - string - required
jsonWhere: The JSON where clause - string - required
collectionId: The collection id - string - required
jsonWhere: The JSON where clause - string - required
admin
mongodb collection_delete "collection1" "{\"name\": \"jim\"}";
mentdb
3
mongodb collection_select <collectionId> <jsonFilter> <jsonSort> <jsonProjection> <jsonHint> <jsonMin> <jsonMax> <batchSize> <skip> <limit>
Description
Select elements from a collection
Select elements from a collection
Parameters
collectionId: The collection id - string - required
jsonFilter: The JSON filter object - string - required
jsonSort: The JSON sort object - string - required
jsonProjection: The JSON projection object - string - required
jsonHint: The JSON hint object - string - required
jsonMin: The JSON min object - string - required
jsonMax: The JSON max object - string - required
batchSize: The batch size - number - required
skip: The position to skip to - number - required
limit: The number of rows to return - number - required
collectionId: The collection id - string - required
jsonFilter: The JSON filter object - string - required
jsonSort: The JSON sort object - string - required
jsonProjection: The JSON projection object - string - required
jsonHint: The JSON hint object - string - required
jsonMin: The JSON min object - string - required
jsonMax: The JSON max object - string - required
batchSize: The batch size - number - required
skip: The position to skip to - number - required
limit: The number of rows to return - number - required
admin
mongodb collection_select "collection1" null null null null null null null null null;
mentdb
"[ { \"_id\": { \"$oid\": \"5f81a9f2af9aad3b3a0b942b\" }, \"age\": 20 } ]"
admin
mongodb disconnect all; mongodb database_unload all; mongodb collection_unload all; mongodb connect "mongodb://localhost:27017" "client1"; mongodb database_load "client1" "database1" "jim"; mongodb collection_load "database1" "collection1" "collection_jim"; mongodb collection_delete "collection1" "{\"name\": \"jim\"}"; mongodb collection_delete "collection1" "{\"name\": \"toto\"}"; mongodb collection_delete "collection1" "{\"name\": \"payet\"}"; mongodb collection_insert "collection1" "{\"name\": \"payet\", \"age\": 10}"; mongodb collection_insert "collection1" "{\"name\": \"jim\", \"age\": 20}"; mongodb collection_insert "collection1" "{\"name\": \"toto\", \"age\": 40}"; mongodb collection_select "collection1" null null null null null null null null null; mongodb collection_select "collection1" "{\"name\": \"jim\"}" null null null null null null null null; mongodb collection_select "collection1" null "{\"age\": 1}" null null null null null null null; mongodb collection_select "collection1" null "{\"age\": 1}" "{\"age\": 1}" null null null null null null; mongodb collection_select "collection1" "{\"name\": \"jim\"}" "{\"age\": 1}" "{\"age\": 1}" null null null null 1 1;
mentdb
[]
mongodb database_stat <databaseId>
Description
Show the statistics of a specific database
Show the statistics of a specific database
Parameters
databaseId: The database id - string - required
databaseId: The database id - string - required
admin
mongodb database_stat "database1";
mentdb
{"objects":3,"dataSize":135.0,"indexSize":32768.0,"indexes":1,"collections":1,"storageSize":32768.0,"numExtents":0,"fsUsedSize":1.13795637248E11,"avgObjSize":45.0,"ok":1.0,"db":"jim","views":0,"fsTotalSize":4.99963174912E11}
