0.1.6 • Published 1 year ago

cloudflare-mongodb v0.1.6

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Cloudflare MongoDB

MongoDB Driver for Cloudflare Workers

Example

import { CloudflareMongoClient, Document } from 'cloudflare-mongodb'

type User = Document & {
  firstName: string
}

const client = new CloudflareMongoClient({
  /**
   * Proxy api url
   */
  apiServiceUrls: ['https://mongodb-proxy.g7p.io'],
  /**
   * Authentication token, keep it secured
   */
  apiAuthToken: process.env.API_AUTH_TOKEN,
})

const db = client.db('g7')
const users = db.collection<User>('users')

// Insert
const user = await users.insertOne({
  firstName: 'Ezeki',
})

// Update
await users.updateOne(
  { _id: user?.id },
  {
    $set: {
      firstName: 'EzekiX',
    },
  },
)
0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago