Skip to content

Import Documents into a Collection​

POST
/mongodb/collections/{collectionName}/documents/import

Store the documents of the request body: one JSON document per line (NDJSON, as written by the export). A line is read like a document in the body of an insert (Extended JSON wrappers, dates). The body is read as a stream and the documents are stored in batches without ordering, a line that cannot be stored does not stop the others: the answer counts what was read, stored and failed and names the first failed lines (errors, index is the number of the line). The size of the body is limited by IMPORT_MAX_BYTES (413 above), there is no time limit. Since 2.0.0 an import that is aborted (413, a line that is too long, a database or connection error) stores nothing: the documents stored before the abort are deleted again, x-error-additional-info says so.

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

Request Body​

text/plain
JSON
"string"

Responses​

application/json
JSON
{
  
"read": 0,
  
"inserted": 0,
  
"failed": 0,
  
"errors": [
  
  
{
  
  
  
"index": 0,
  
  
  
"code": 0,
  
  
  
"message": "string"
  
  
}
  
],
  
"errorsTruncated": true
}

Playground​

Authorization
Variables
Key
Value
Body

Samples​

Powered by VitePress OpenAPI

Released under the MIT License.