|<code>CREATE DATABASE [name] ([input])</code>
|-
| valign='top' | '''Permission'''
|''CREATE''
|-
| valign='top' | '''Summary'''
|Creates the database <code>[name]</code> with an optional <code>[input]</code>.<br />The input may either be a reference to a single XML document, a directory, a remote URL, or a string containing XML. <code>[name]</code> must be a [[#Valid Names|valid database name]].
|-
| valign='top' | '''Errors'''
|The command fails if a database with the specified name is currently used by another process, if one of the documents to be added is not well-formed or if it cannot be parsed for some other reason.
|-
| valign='top' | '''Examples'''
|
* <code>CREATE DATABASE input</code><br/>creates an empty database <code>input</code>.
|<code>OPEN [path]</code>
|-
| valign='top' | '''Permission'''
|''READ''
|-
| valign='top' | '''Summary'''
|Opens a database or some of its documents. <code>[path]</code> is the name of the database. If the name is further refined by a path, only some of the documents in the database will be opened.
|-
| valign='top' | '''Errors'''
|The command fails if the specified database does not exist, is currently being updated by another process, cannot be opened for some other reason.
|}
|<code>CHECK [input]</code>
|-
| valign='top' | '''Permission'''
|''READ/CREATE''
|-
| valign='top' | '''Summary'''
|This command combines [[#OPEN|OPEN]] and [[#CREATE DATABASE|CREATE DATABASE]]: if a database with the name {{Mono|[input]}} exists, it is opened. Otherwise, it creates a new database and stores the specified input as initial content.
|-
| valign='top' | '''Errors'''
|The command fails if the addressed database could neither be opened nor created.
|}
|<code>CLOSE </code>
|-
| valign='top' | '''Permission'''
|''READ''
|-
| valign='top' | '''Summary'''
|Closes the currently opened database.
|-
| valign='top' | '''Errors'''
|The command fails if the database files could not be closed for some reason.
|}
|<code>EXPORT [path]</code>
|-
| valign='top' | '''Permission'''
|''CREATE''
|-
| valign='top' | '''Summary'''
|Exports all documents in the database to the specified <code>[path]</code>, using the serializer options specified by the <code>[[Options#EXPORTER|EXPORTER]]</code> option.
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened, if the target path points to a file or is invalid, if the serialization parameters are invalid, or if the documents cannot be serialized for some other reason.
|}
|<code>CREATE INDEX [TEXT|ATTRIBUTE|FULLTEXT]</code>
|-
| valign='top' | '''Permission'''
|''WRITE''
|-
| valign='top' | '''Summary'''
|Creates the specified database [[Indexes|index]].
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened, if the specified index is unknown, or if indexing fails for some other reason.
|}
|<code>DROP INDEX [TEXT|ATTRIBUTE|FULLTEXT]</code>
|-
| valign='top' | '''Permission'''
|''WRITE''
|-
| valign='top' | '''Summary'''
|Drops the specified database [[Indexes|index]].
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened, if the specified index is unknown, or if it could not be deleted for some other reason.
|}
|<code>ALTER DATABASE [name] [newname]</code>
|-
| valign='top' | '''Permission'''
|''CREATE''
|-
| valign='top' | '''Summary'''
|Renames the database specified by <code>[name]</code> to <code>[newname]</code>. <code>[newname]</code> must be a [[#Valid Names|valid database name]].
|-
| valign='top' | '''Errors'''
|The command fails if the target database already exists, if the source database does not exist or is currently locked, or if it could not be renamed for some other reason.
|-
| valign='top' | '''Examples'''
|
* <code>ALTER DATABASE db tempdb</code><br/>renames the database <code>db</code> into <code>tempdb</code>.
|<code>DROP DATABASE [name]</code>
|-
| valign='top' | '''Permission'''
|''CREATE''
|-
| valign='top' | '''Summary'''
|Drops the database with the specified <code>[name]</code>. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database.
|-
| valign='top' | '''Errors'''
|The command fails if the specified database does not exist or is currently locked, or if the database could not be deleted for some other reason.
|}
|<code>CREATE BACKUP [name]</code>
|-
| valign='top' | '''Permission'''
|''CREATE''
|-
| valign='top' | '''Summary'''
|Creates a zipped backup of the database specified by {{Mono|[name]}}. The backup file will be suffixed with the current timestamp and stored in the database directory. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database.
|-
| valign='top' | '''Errors'''
|The command fails if the specified database does not exist, or if it could not be zipped for some other reason.
|-
| valign='top' | '''Examples'''
|
* <code>BACKUP db</code><br/>creates a zip archive of the database <code>db</code> (e.g. <code>db-2011-04-01-12-27-28.zip</code>) in the [[Configuration#Database_Directory|database directory]].
|<code>RESTORE [name]</code>
|-
| valign='top' | '''Permission'''
|''CREATE''
|-
| valign='top' | '''Summary'''
|Restores a database with the specified <code>[name]</code>. The name may include the timestamp of the backup file.
|-
| valign='top' | '''Errors'''
|The command fails if the specified backup does not exist, if the database to be restored is currently locked, or if it could not be restored for some other reason.
|}
|<code>DROP BACKUP [name]</code>
|-
| valign='top' | '''Permission'''
|''CREATE''
|-
| valign='top' | '''Summary'''
|Drops all backups of the database with the specified <code>[name]</code>. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database.
|-
| valign='top' | '''Examples'''
|
* <code>DROP BACKUP abc*</code><br/>deletes the backups of all databases starting with the characters <code>abc</code>.
|<code>SHOW BACKUPS</code>
|-
| valign='top' | '''Permission'''
|''CREATE''
|-
| valign='top' | '''Summary'''
|Shows all database backups.
|}
|<code>COPY [name] [newname]</code>
|-
| valign='top' | '''Permission'''
|''CREATE''
|-
| valign='top' | '''Summary'''
|Creates a copy of the database specified by <code>[name]</code>. <code>[newname]</code> must be a [[#Valid Names|valid database name]].
|-
| valign='top' | '''Errors'''
|The command fails if the target database already exists, or if the source database does not exist.
|}
|<code>INFO DATABASE</code>
|-
| valign='top' | '''Permission'''
|''READ''
|-
| valign='top' | '''Summary'''
|Shows information on the currently opened database.
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened.
|}
|<code>INFO INDEX ([TEXT|ATTRIBUTE|FULLTEXT|PATH])</code>
|-
| valign='top' | '''Permission'''
|''READ''
|-
| valign='top' | '''Summary'''
|Shows information on the existing [[Indexes|index]] structures. The output can be optionally limited to the specified index.
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened, or if the specified index is unknown.
|}
| <code>INFO STORAGE [start end] | [query]</code>
|-
| valign='top' | '''Permission'''
|''READ''
|-
| valign='top' | '''Summary'''
|Shows the internal main table of the currently opened database. An integer range or a query may be specified as argument.
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened, or if one of the specified arguments is invalid.
|}
|<code>LIST ([path])</code>
|-
| valign='top' | '''Permission'''
|''NONE''
|-
| valign='top' | '''Summary'''
|Lists all available databases, or the documents in a database. <code>[path]</code> is the name of the database, optionally followed by a path to the requested documents.
|-
| valign='top' | '''Errors'''
|The command fails if the optional database cannot be opened, or if the existing databases cannot be listed for some other reason.
|}
|<code>XQUERY [query]</code>
|-
| valign='top' | '''Permission'''
|''depends on query''
|-
| valign='top' | '''Summary'''
|Runs the specified <code>[query]</code> and prints the result.
|-
| valign='top' | '''Errors'''
|The command fails if the specified query is invalid.
|-
| valign='top' | '''Examples'''
|
* <code>XQUERY 1 to 10</code><br/>returns the sequence <code>(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)</code>.
|<code>RETRIEVE [path] [input]</code>
|-
| valign='top' | '''Permission'''
|''READ''
|-
| valign='top' | '''Summary'''
|Retrieves raw data from the specified database <code>[path]</code>.
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened, if the source path is invalid or if the data cannot not be retrieved for some other reason.
|}
|<code>RUN [file]</code>
|-
| valign='top' | '''Permission'''
|''depends on query''
|-
| valign='top' | '''Summary'''
|Runs the query contained in <code>[file]</code> and prints the result.
|-
| valign='top' | '''Errors'''
|The command fails if the specified file does not exist, or if the retrieved query is invalid.
|}
|<code>FIND [keywords]</code>
|-
| valign='top' | '''Permission'''
|''READ''
|-
| valign='top' | '''Summary'''
|Builds and runs a query for the specified <code>[keywords]</code>. Keywords can be enclosed in quotes to look for phrases. The following modifiers can be used to further limit search:
<code>= </code> looks for exact text nodes<br/><code>~ </code> looks for approximate hits<br/><code>@=</code> looks for exact attribute values<br/><code>@ </code> looks for attributes
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened.
|}
|<code>CS [query]</code>
|-
| valign='top' | '''Permission'''
|''depends on query''
|-
| valign='top' | '''Summary'''
|Evaluates the specified <code>[query]</code> and sets the result as new context set.
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened, if the specified query is invalid or if it does not return nodes of the currently opened database.
|}
|<code>REPO INSTALL [path]</code>
|-
| valign='top' | '''Permission'''
|''CREATE'' ({{Mark|before Version 7.2}}: ''ADMIN'')
|-
| valign='top' | '''Summary'''
| Installs the package with path <code>[path]</code>.
|-
| valign='top' | '''Errors'''
| The command fails in the following cases:
* The package to be installed is not a xar file.
|<code>REPO LIST</code>
|-
| valign='top' | '''Permission'''
|''READ'' ({{Mark|before Version 7.2}}: ''ADMIN'')
|-
| valign='top' | '''Summary'''
| Lists all installed packages.
|}
|<code>REPO DELETE [name|dir]</code>
|-
| valign='top' | '''Permission'''
|''CREATE'' ({{Mark|before Version 7.2}}: ''ADMIN'')
|-
| valign='top' | '''Summary'''
| Deletes the package with name <code>[name]</code> or with directory <code>[dir]</code>.
|-
| valign='top' | '''Errors'''
| The command fails if the package to be deleted participates in a dependency.
|}
|<code>ADD (TO [path]) [input]</code>
|-
| valign='top' | '''Permission'''
|''WRITE''
|-
| valign='top' | '''Summary'''
|Adds the files, directory or XML string specified by <code>[input]</code> to the currently opened database at the specified <code>[path]</code>.<br/><code>[input]</code> may either be a single XML document, a directory, a remote URL or a plain XML string. If the path denotes a directory, it needs to be suffixed with a slash (<code>/</code>).
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened, if one of the documents to be added is not well-formed, or if it could not be parsed for some other reason.
|-
| valign='top' | '''Examples'''
|
* <code>ADD input.xml</code><br/>adds the file <code>input.xml</code> to the database.
|<code>DELETE [path]</code>
|-
| valign='top' | '''Permission'''
|''WRITE''
|-
| valign='top' | '''Summary'''
|Deletes all documents from the currently opened database that start with the specified <code>[path]</code>.
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened.
|}
|<code>RENAME [path] [newpath]</code>
|-
| valign='top' | '''Permission'''
|''WRITE''
|-
| valign='top' | '''Summary'''
|Renames all document paths in the currently opened database that start with the specified <code>[path]</code>. The command may be used to either rename single documents or directories.
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened, or if the target path is empty.
|-
| valign='top' | '''Examples'''
|
* <code>RENAME one.xml two.xml</code><br/>renames the document <code>one.xml</code> to <code>two.xml</code>.
|<code>REPLACE [path] [input]</code>
|-
| valign='top' | '''Permission'''
|''WRITE''
|-
| valign='top' | '''Summary'''
|Replaces the documents in the currently opened database, addressed by <code>[path]</code>, with the file or XML string specified by <code>[input]</code>. The original file name and path is preserved by the operation.
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened, if the specified path points to a database directory, or if the input is not found.
|-
| valign='top' | '''Examples'''
|
* <code>REPLACE one.xml input.xml</code><br/>replaces the document <code>one.xml</code> with the contents of the file <code>input.xml</code>.
|<code>STORE (TO [path]) [input]</code>
|-
| valign='top' | '''Permission'''
|''WRITE''
|-
| valign='top' | '''Summary'''
|Stores raw data to the specified <code>[path]</code>. <code>[input]</code> may either be a file reference, a remote URL, or a plain string. If the path denotes a directory, it needs to be suffixed with a slash (<code>/</code>).
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened, if the specified resource is not found, if the target path is invalid or if the data cannot not be written for some other reason.
|}
|<code>OPTIMIZE (ALL)</code>
|-
| valign='top' | '''Permission'''
|''WRITE''
|-
| valign='top' | '''Summary'''
|Optimizes the index structures, meta data and statistics of the currently opened database. If the {{Mono|ALL}} flag is specified, the internal database structures are completely rebuilt; this often leads to a reduction of the total database size.
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened, or if the currently opened database is a main-memory instance.
|}
|<code>FLUSH</code>
|-
| valign='top' | '''Permission'''
|''WRITE''
|-
| valign='top' | '''Summary'''
|Explicitly flushes the buffers of the currently opened database to disk. This command is applied if the [[Options#AUTOFLUSH|AUTOFLUSH]] option has been set to false.
|-
| valign='top' | '''Errors'''
|The command fails if no database is opened.
|}
|<code>SHOW DATABASES</code>
|-
| valign='top' | '''Permission'''
|''ADMIN''
|-
| valign='top' | '''Summary'''
|Shows all databases that are opened in the current server instance.
|}
|<code>SHOW SESSIONS</code>
|-
| valign='top' | '''Permission'''
|''ADMIN''
|-
| valign='top' | '''Summary'''
|Shows all sessions that are connected to the current server instance.
|}
|<code>SHOW USERS (ON [database])</code>
|-
| valign='top' | '''Permission'''
|''ADMIN''
|-
| valign='top' | '''Summary'''
|Shows all users that are registered in the database. If a <code>[database]</code> is specified, local users are shown.
|-
| valign='top' | '''Errors'''
|The command fails if the optional database could not be opened.
|}
|<code>KILL [target]</code>
|-
| valign='top' | '''Permission'''
|''ADMIN''
|-
| valign='top' | '''Summary'''
|Kills sessions of a user or an IP:port combination, specified by <code>[target]</code>. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one user.
|-
| valign='top' | '''Errors'''
|The command fails if a user tried to kill his/her own session.
|}
|<code>CREATE EVENT [NAME]</code>
|-
| valign='top' | '''Permission'''
|''ADMIN''
|-
| valign='top' | '''Summary'''
|Creates the specified [[Events|event]].
|-
| valign='top' | '''Errors'''
|The command fails if event already exists.
|}
|<code>SHOW EVENTS</code>
|-
| valign='top' | '''Permission'''
|''ADMIN''
|-
| valign='top' | '''Summary'''
|Shows all [[Events|events]] that have been registered in the database.
|}
|<code>DROP EVENT [NAME]</code>
|-
| valign='top' | '''Permission'''
|''ADMIN''
|-
| valign='top' | '''Summary'''
|Drops the specified [[Events|event]].
|-
| valign='top' | '''Errors'''
|The command fails if the event doesn't exist.
|}
|<code>CREATE USER [name] ([password])</code>
|-
| valign='top' | '''Permission'''
|''ADMIN''
|-
| valign='top' | '''Summary'''
|Creates a user with the specified <code>[name]</code> and <code>[password]</code>. <code>[name]</code> must be a [[#Valid Names|valid user name]]. The password must be a valid MD5 hash value. If no password is specified in the console mode, it is requested via standard input.
|-
| valign='top' | '''Errors'''
|The command fails if the specified user already exists, or if the password is no valid MD5 hash value.
|}
|<code>ALTER USER [name] ([password])</code>
|-
| valign='top' | '''Permission'''
|''ADMIN''
|-
| valign='top' | '''Summary'''
|Alters the <code>[password]</code> of the user specified by <code>[name]</code>. The password must be a valid MD5 hash value. If no password is specified in the console mode, it is requested via standard input.
|-
| valign='top' | '''Errors'''
|The command fails if the specified user does not exist, or if the password is no valid MD5 hash value.
|}
|<code>DROP USER [name] (ON [database])</code>:
|-
| valign='top' | '''Permission'''
|''ADMIN''
|-
| valign='top' | '''Summary'''
|Drops the user with the specified <code>[name]</code>. If a <code>[database]</code> is specified, the user is only dropped locally. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database or user.
|-
| valign='top' | '''Errors'''
|The command fails if <code>admin</code> is specified as user name, if the specified user does not exist or is logged in, or if the optional database could not be opened for modification.
|}
|<code>GRANT [NONE|READ|WRITE|CREATE|ADMIN] (ON [database]) TO [user]</code>
|-
| valign='top' | '''Permission'''
|''ADMIN''
|-
| valign='top' | '''Summary'''
|Grants the specified [[User_Management|permission]] to the specified <code>[user]</code>. If a <code>[database]</code> is specified, the permissions are only granted locally. The [[#Glob Syntax|Glob Syntax]] can be used to address more than one database or user.
|-
| valign='top' | '''Errors'''
|The command fails if <code>admin</code> is specified as user name, if the specified user does not exist, or if the optional database could not be opened for modification.
|-
| valign='top' | '''Examples'''
|
* <code>GRANT READ TO JoeWinson</code><br/>grants <code>READ</code> permission to the user <code>JoeWinson</code>.
|<code>PASSWORD ([password])</code>
|-
| valign='top' | '''Permission'''
|''NONE''
|-
| valign='top' | '''Summary'''
|Changes the <code>[password]</code> of the current user. The password must be a valid MD5 hash value. If no password is specified in the console mode, it is requested via standard input.
|-
| valign='top' | '''Errors'''
|The command fails if the password is no valid MD5 hash value.
|}
|<code>GET [option]</code>
|-
| valign='top' | '''Permission'''
|''NONE''
|-
| valign='top' | '''Summary'''
|Returns the current value of the [[Options|Option]] specified via {{Mono|[key]}}.
|-
| valign='top' | '''Errors'''
|The command fails if the specified option is unknown.
|}
|<code>SET [option] ([value])</code>
|-
| valign='top' | '''Permission'''
|''NONE''
|-
| valign='top' | '''Summary'''
|Sets the [[Options|Option]] with the specified <code>[key]</code> to a new <code>[value]</code>. If no value is specified, and if the value is boolean, it will be inverted.
|-
| valign='top' | '''Errors'''
|The command fails if the specified option is unknown or if the specified value is invalid.
|}
|<code>INFO</code>
|-
| valign='top' | '''Permission'''
|''READ''
|-
| valign='top' | '''Summary'''
|Shows global information.
|}
|<code>HELP ([command])</code>
|-
| valign='top' | '''Permission'''
|''NONE''
|-
| valign='top' | '''Summary'''
|If <code>[command]</code> is specified, information on the specific command is printed; otherwise, all commands are listed.
|-
| valign='top' | '''Errors'''
|The command fails if the specified command is unknown.
|}
|<code>EXIT </code>
|-
| valign='top' | '''Permission'''
|''NONE''
|-
| valign='top' | '''Summary'''
|Exits the console mode.
|}