- Multidomain MDM
- Product Briefing Videos
- Contact Us
Connect to, and disconnect from servers, create, list and and drop databases .
usage from API: void connect(host, port, username, password) usage from CLI: java -jar monsterDB.jar -h host -p port -u username -p passwordConnects to the remote server using TCP/IP protocol, host can be dns or ip address, port must be a valid integer but generally defaults to 27018, username and password are clear text versions of the authentication, this must be setup on the server, but in default installations are not required.
usage from API: void disconnect() usage from CLI: disconnect
Disconnects from any server connection, this command will discard any session data including cursors, therefore you should exhaust any data cursors before doing this. Also note that a session will automatically disconnect after 5 minutes of inactivity and similarly cursor data will be discarded. This is in an attempt to save memory on the server.
usage from API: void createDatabase(name) usage from CLI: create name
Creates a database if it does not exist, alternatively it will connect to an existing database without error. In the event that you have moved a database from one machine to another you may use this command to connect to the moved files. The create command will also set the current database in use in the CLI.
usage from API: void dropDatabase(databaseName) usage from CLI: drop databaseName
Drops a database and all collections within it, this will destroy any data associated with the database including any metadata. Cursors referring to this database or collections will still be valid, however may become unstable.
usage from API: List<Document> listDatabaseNames() usage from CLI: listDatabaseNames
Shows the currently available databases on the server. Return value is a list of documents each one containing a database name.
usage from API: useDatabase(databaseName) usage from CLI: use databaseName
Connects the default database in the connection to the value supplied, all collection commands will be redirected to this database for evaluation, there is not need to refer to the database name in queries after this is called.
If the user requires more verbose output from the optimizer then set the debug to true, this will instruct the cost based optimizer to explain the query path and cost savings used when a user executes a more complex query.
usage from API: setDebug(true|false) usage from CLI: setDebug true|false