Compose Database-as-a-Service Help and Documentation

Everything you need to know about Compose, Hosted or Enterprise, is here in our help system. Whether you run one database for your businesses' sole application or six different databases to support an entire corporation, we've got the information you need.

MongoDB Databases

❗️

This is the older REST API and is now deprecated.

Go to the dedicated apidocs.compose.com for details of the current API which works with all Compose databases with the exception of the MongoDB Classic deployments.

📘

Base URL

All MongoDB database endpoint URLs begin with:

/deployments/:account/:deployment

To improve readability, we’ve substituted a . for this string in the descriptions below.

Common Parameters

ParamDescription
:accountAn account slug
:deploymentA deployment id or name
:databaseThe name of a database on :deployment

GET ./mongodb/:database/stats

GET /deployments/:account/:deployment/mongodb/:database/stats

Return stats from all members associated with the database.

This is the same information returned from the MongoDB db.stats() shell command.

Querystring Parameters

NameTypeDescription
scaleIntegerBytesize scale, i.e. a value of 1024 works like db.stats(1024).

Request

curl -i -X GET 'https://api.compose.io/deployments/your-account/deployment-1/mongodb/database-1/stats' \
-H 'Content-Type: application/json' \
-H 'Accept-Version: 2014-06' \
-H 'Authorization: Bearer [OAUTH_TOKEN]'

Response

[
  {
    "a.host.name:10000": {
      "avgObjSize": 435.58620689655174,
      "collections": 23,
      "dataFileVersion": {
        "major": 4,
        "minor": 5
      },
      "dataSize": 164216,
      "db": "database-1",
      "fileSize": 201326592,
      "indexSize": 171696,
      "indexes": 21,
      "nsSizeMB": 16,
      "numExtents": 27,
      "objects": 377,
      "ok": 1,
      "storageSize": 651264
    }
  }
]

Still Need Help?

If this article didn't solve things, summon a human and get some help!

Updated 11 months ago

MongoDB Databases


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.