Available

amalgame-mongodb

Dynamic-link binding to the mongo-c-driver. Document model.

amc package add mongodb GitHub ↗ ← Back to the ecosystem

Overview

The official MongoDB C client (libmongoc + libbson) is linked dynamically. The API surfaces documents as JSON in/out — BSON conversion is handled under the hood to stay ergonomic on the Amalgame side.

Features

  • Binding to system libmongoc and libbson
  • Document API: InsertOne, FindMany, UpdateOne, DeleteMany
  • JSON in/out — no exotic BSON operator to learn
  • Indexes, aggregates, sessions and transactions
  • TLS via the native mongo-c-driver chain

Example

Minimal usage example — copy-paste runnable after install.

amc package add mongodb

let mc = MongoClient.Connect("mongodb://localhost:27017")
let users = mc.Collection("app", "users")
users.InsertOne({ name: "Alice", age: 30 })
let adults = users.FindMany({ age: { "$gte": 18 } })

At a glance

Related packages