confdb
Queries databases, collections, documents, and commit logs in the configuration database (ConfigDatabase). Administrator privilege is required to run this command.
Command properties
| Item | Description |
|---|---|
| Command type | Driver query |
| Required permission | Administrator |
| License usage | N/A |
| Parallel execution | Not supported |
| Distributed execution | Not supported |
Syntax
To list databases:
confdb databases
To list collections:
confdb cols DB_NAME
To query documents:
confdb docs DB_NAME COL_NAME
To query commit logs:
confdb logs DB_NAME
Target
OP- Query type to perform.
databases: Lists all databases in the configuration database.cols: Lists collections in the specified database.docs: Queries documents in a collection within the specified database.logs: Queries commit logs for the specified database.
DB_NAME- Target database name. Required for
cols,docs, andlogsqueries. COL_NAME- Target collection name. Required for
docsqueries.
Output fields
For databases queries:
| Field | Type | Description |
|---|---|---|
| name | string | Database name |
| rev | long | Latest revision number |
| commits | long | Number of commits |
| last_msg | string | Last commit message |
| last_commit | timestamp | Last commit time |
For cols queries:
| Field | Type | Description |
|---|---|---|
| name | string | Collection name |
For docs queries:
| Field | Type | Description |
|---|---|---|
| doc_id | integer | Document identifier |
| doc_prev | integer | Previous revision number |
| doc_rev | integer | Current revision number |
| doc | object | Document content. When the document is a map type, each key-value pair is assigned as an individual field. |
For logs queries:
| Field | Type | Description |
|---|---|---|
| _time | timestamp | Commit time |
| rev_id | long | Revision identifier |
| committer | string | Account that performed the commit |
| msg | string | Commit message |
| manifest_id | long | Manifest identifier. Assigned only when the configuration database supports it. |
Error codes
Parse errors
| Error code | Message | Description |
|---|---|---|
| 10000 | Permission denied. Administrator privilege is required. | Administrator privilege is absent. |
| 10001 | No option value entered. | No query type (databases, cols, docs, logs) is specified. |
| 10002 | Enter the confdb database name. | No database name is specified for cols, docs, or logs queries. |
| 10003 | Enter the confdb collection name. | No collection name is specified for docs queries. |
| 10004 | [op] is an unsupported option. | An unsupported query type is specified. |
Runtime errors
N/A
Description
The confdb command directly queries the internal data of the system configuration database.
databasesquery: Returns a list of all databases along with each database's revision number, commit count, and last commit information.colsquery: Returns a list of collection names in the specified database. Returns no results if the database does not exist.docsquery: Returns all documents in the specified collection. When a document is a map type, each key-value pair is assigned as an individual output field. Otherwise, the entire document is assigned to thedocfield.logsquery: Returns commit logs for the specified database in batches of up to 1,000 records.
Examples
-
Listing databases
confdb databasesLists all databases in the configuration database.
-
Listing collections
confdb cols araqne-log-apiLists all collections in the
araqne-log-apidatabase. -
Querying documents
confdb docs araqne-log-api loggerQueries all documents in the
loggercollection of thearaqne-log-apidatabase. -
Querying commit logs
confdb logs araqne-log-apiQueries the commit logs for the
araqne-log-apidatabase.