Definition
abortRewriteCollectionStops an in-progress
rewriteCollectionoperation.New in version 8.3.
Compatibility
This command is available in deployments hosted in the following environments:
MongoDB Atlas: The fully managed service for MongoDB deployments in the cloud
Note
This command is supported in all MongoDB Atlas clusters. For information on Atlas support for all commands, see Unsupported Commands.
MongoDB Enterprise: The subscription-based, self-managed version of MongoDB
MongoDB Community: The source-available, free-to-use, and self-managed version of MongoDB
Syntax
db.adminCommand( { abortRewriteCollection: "<database>.<collection>" } )
Command Fields
The command takes the following field:
Field | Type | Necessity | Description |
|---|---|---|---|
| string | Required | Specifies the database and collection to stop rewriting. |
Access Control
The abortRewriteCollection command requires the
rewriteCollection privilege action on the cluster
or on the database and collection on which you want to stop the
rewrite.
This privilege action is also available to users with the following roles:
Examples
Consider the following example of a collection rewrite:
db.adminCommand( { rewriteCollection: "sales.orders" } )
To stop this rewrite, pass the database and collection name to
the abortRewriteCollection command:
db.adminCommand( { abortRewriteCollection: "sales.orders" } )