0.1.6 • Published 12 months ago

cloudflare-mongodb v0.1.6

Weekly downloads
-
License
ISC
Repository
-
Last release
12 months 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

12 months ago

0.1.5

12 months ago

0.1.4

12 months ago

0.1.3

12 months ago

0.1.2

12 months ago

0.1.1

12 months ago

0.1.0

12 months ago