module
mongodb
MongoDB through your own API route. Atlas retired its HTTP Data API (September 2025), and a database password must never reach the browser, so the browser sends Commands to a server route (generated by weft add mongodb), which checks them against a Policy and runs them with the official driver.
let db = Mongo::new("/api/mongo");
let req = db.find("products", json!({ "tags": "lamp" })).sort(json!({ "price": 1 })).limit(12).request();
let docs = mongodb::parse_documents(&weft::web::fetch(req).await?)?;Structs
Enums
Functions
iso_from_millis
pub fn iso_from_millis(ms: i64) -> StringMilliseconds since the epoch → YYYY-MM-DDTHH:MM:SS.mmmZ.
parse_documents
pub fn parse_documents(res: &Response) -> Result<Value, Error>The documents from a find/aggregate (or the one from findOne) as a list of records.
reply_documents
pub fn reply_documents(docs: Vec<Value>) -> ValueThe reply body for each action (used by the server route).
simplify
pub fn simplify(j: &Value) -> ValueRelaxed Extended JSON → plain JSON: {"$oid": x} → x, {"$date": …} → an ISO string, $numberLong/$numberInt/$numberDouble/ $numberDecimal → numbers.