Skip to content

Restore a Version of a Document​

POST
/mongodb/collections/{collectionName}/documents/{documentId}/history/{auditId}/restore

Puts a document back to its state after (state=before: before) an audit record of a collection declared with audit (2.11.0): a replace through validation, behaviours and access rules (a versioned document gets a new version), or an insert when the document was deleted. Audited as restore. 400 for a collection without audit or a record without that state, 404 for a record of another document or a document outside the scope of the caller. Needs write and read.

Authorizations​

httpAuth
Type
HTTP (bearer)
or
httpAuth1
Type
HTTP (basic)
or
apiKeyAuth
Type
API Key (header: X-AUTH-APIKEY)

Parameters​

Path Parameters

collectionName*

The name of your MongoDb Collection

Type
string
Required
documentId*

DocumentId to restore

Type
string
Required
auditId*

The _id of the audit record (hex)

Type
string
Required

Query Parameters

state

after (default) or before the audited write

Type
string
Valid values
"after""before"

Responses​

application/json
JSON
{
  
"wasAcknowledged": true,
  
"upsertedIds": [
  
  
"string"
  
],
  
"modifiedCount": 0,
  
"matchedCount": 0
}

Playground​

Authorization
Variables
Key
Value

Samples​

Powered by VitePress OpenAPI

Released under the MIT License.