adminCommand
adminCommand
is a Change Type in the Liquibase Open Source and Liquibase Pro extensions for MongoDB that provides a helper to run specified database commands against the admin
database.
Uses
The Liquibase Pro extension for MongoDB includes several modeled Change Types from the Liquibase Open Source version. These let you specify a few MongoDB commands using Liquibase XML, JSON, and YAML changelogs.
adminCommand
is one such Change Type. You can use it to run commands on the built-in admin
database. You must be an administrator in MongoDB to use this Change Type successfully. For more information, see Manage Users and Roles.
If you want to run commands on another database, use runCommand
instead.
Note: If you want to specify mongosh
statements in your XML, JSON, and YAML changelogs, use the mongo
and mongoFile
Change Types instead.
Run
To run this Change Type, follow these steps:
Add the Change Type to your changeset, as shown in the examples on this page.
Specify any required attributes. Use the table on this page to see which ones your database requires.
Deploy your changeset by running the
update
command:liquibase update
Available attributes
For more information, see db.adminCommand().
Tip: You must specify all top-level attributes marked as required. If you specify an optional attribute, you must also specify any nested attributes that it requires.
Name | Type | Description | Requirement |
| Raw JSON |
adminCommand examples
databaseChangeLog:
- changeSet:
id: 1
author: your.name
changes:
- adminCommand:
command: |
{
buildInfo: 1
}
- rollback: null