Available
amalgame-mongodb
Dynamic-link binding to the mongo-c-driver. Document model.
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
libmongocandlibbson - ✓Document API:
InsertOne,FindOne,FindMany,UpdateOne,DeleteOne,Count - ✓JSON in/out — no exotic BSON operator to learn
- ✓Full MongoDB URI: credentials,
authSource,mongodb+srv://(Atlas)
Planned
- ◐Indexes and aggregation pipelines
- ◐Sessions and transactions
- ◐Bulk writes (
InsertMany,UpdateMany,DeleteMany) - ◐Connection pool for multi-threaded apps
Example
Minimal usage example — copy-paste runnable after install.
import Amalgame.Database.NoSQL.MongoDB
public class Program {
public static void Main() {
let db = MongoDB.Connect("mongodb://localhost:27017")
if (!MongoDB.Ping(db)) {
Console.WriteLine("server unreachable: " + MongoDB.LastError(db))
return
}
MongoDB.InsertOne(db, "app", "users", "{\"name\":\"Alice\",\"age\":30}")
let adults = MongoDB.FindMany(db, "app", "users", "{\"age\":{\"$gte\":18}}")
for i in 0..adults.Count() {
let doc: string = adults.Get(i)
Console.WriteLine(doc)
}
MongoDB.Close(db)
}
}
At a glance
- License: Apache-2.0
- Install:
amc package add mongodb - Source: amalgame-lang/amalgame-database-nosql-mongodb
- Official index: amalgame-lang/packages-index