MongoDB Data API Client
npm install @ph4ntomiki/mongodb-data-api-clientjavascript
const MongoClient = require('@ph4ntomiki/mongodb-data-api-client');
const client = MongoClient('app_id', 'api_key', 'clusterName'); //cluster defaults to 'Cluster0'
const db = client.db('dbName');
const collection = db.collection('collectionName');const results = await collection.find({title: /a/i});
`You can also create client with custom fetch implementation, like for ex. for Cloudflare Workers like this:
`javascript
const client = MongoClient('app_id', 'api_key', 'clusterName', {'fetch': fetch.bind(self)});
`
Or if you want default clusterName you can pass `undefined` or `null`` at that place.