MongoDB
Here you can control MongoDB server.
mongodb connect <url> <clientId>
Description
Connect to a database
Parameters
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 loaded collection
admin
mongodb client_show_loaded;
mentdb
["client1"]
mongodb client_exist <clientId>
Description
Check if mongodb is already loaded
Parameters
clientId: The client id - string - required
admin
mongodb client_exist "client1";
mentdb
1
mongodb disconnect <clientId>
Description
Disconnect a MongoDB connection
Parameters
clientId: The client id - string - required
admin
mongodb disconnect "client1";
mentdb
1
mongodb disconnect all
Description
Disconnect all MongoDB connections
admin
mongodb disconnect all;
mentdb
1
mongodb database_show <clientId>
Description
Show all databases from a MongoDB server
Parameters
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 the memory
Parameters
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 loaded collection
admin
mongodb database_show_loaded;
mentdb
["database1"]
mongodb database_exist <databaseId>
Description
Check if a database is already loaded
Parameters
databaseId: The database id - string - required
admin
mongodb database_exist "database1";
mentdb
1
mongodb database_unload <databaseId>
Description
Unload a database from the memory
Parameters
databaseId: The database id - string - required
admin
mongodb database_unload "database1";
mentdb
1
mongodb database_unload all
Description
Unload all databases from the memory
admin
mongodb database_unload all;
mentdb
1
mongodb collection_show <databaseId>
Description
Show all collections from a database
Parameters
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 the memory
Parameters
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 loaded collection
admin
mongodb collection_show_loaded;
mentdb
["collection1"]
mongodb collection_exist <collectionId>
Description
Check if a collection is already loaded
Parameters
collectionId: The collection id - string - required
admin
mongodb collection_exist "collection1";
mentdb
1
mongodb collection_unload <collectionId>
Description
Unload a collection from the memory
Parameters
collectionId: The collection id - string - required
admin
mongodb collection_unload "collection1";
mentdb
1
mongodb collection_unload all
Description
Unload all collections from the memory
admin
mongodb collection_unload all;
mentdb
1
mongodb collection_insert <collectionId> <json>
Description
Insert a new element into a collection
Parameters
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 from a collection
Parameters
collectionId: The collection id - string - required
jsonTarget: The json target to elements - string - required
jsonAction: The json action on 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
Parameters
collectionId: The collection id - string - required
jsonWhere: The json where - 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
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: Skip to position - number - required
limit: Number of row 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 stat for a specific database
Parameters
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}
© 2012 - 2023