0.1.6 • Published 2 years ago

cloudflare-mongodb v0.1.6

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years 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

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago