mongodb-atlas-data-api-sdk

1.0.5 • Public • Published

mongodb-atlas-data-api-sdk

Node SDK for Mongo Atlas Data API

Mongo Atlas recently released a Beta version of a Data API. Using this API you can access your MongoDB commands via API. This SDK attempts to make that as simple as possible.

API Documentation

Mongo Atlas Data API - BETA

Resources

Examples

For examples of how to use the SDK see this repository.

Usage

import MongoAtlasDataApiSDK from 'mongodb-atlas-data-api-sdk'

const mongoAtlasDataApiSdk = new MongoAtlasDataApiSDK({
    apiKey: API_KEY,
    apiUrl: API_URL,
    dbCluster: DB_CLUSTER,
    dbName: DB_NAME,
    quiet: false
})

const { documents } = await mongoAtlasDataApiSdk.find({
  collection: COLLECTION_NAME,
  filter: {
    _id: {
      $in:
        [
            { $oid: "61c3472a1396e0693eba124c" },
            { $oid: "61eb2496b8f08060d1dee50a" },
        ]
    }
  }
})

Available Methods

findOne

find

insertOne

insertMany

updateOne

updateMany

replaceOne

deleteOne

deleteMany

aggregate

Errors

Notes

This projects uses ESM loader, if you need commonJS please open an issue and I'll add it in for you.

Todo

Testing, better documentation, flow types or typescript.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.5
    1
    • latest

Version History

Package Sidebar

Install

npm i mongodb-atlas-data-api-sdk

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

12.1 kB

Total Files

8

Last publish

Collaborators

  • michaelwclark