Macro memquery::update[][src]

macro_rules! update {
    ($($json:tt)+) => { ... };
}

Construct a serde_json::Value from a JSON literal representing update value for find_and_update API.

use memquery::{doc, errors::Error, memdb::MemDb, query};

let memdb = MemDb::new();
let coll = memdb.collection("TestCollection").await?;

coll.insert(doc!({ "name": "Tom", "age": 25 })).await?;
let docs_updated = coll
 .find_and_update(
   query!({ "name": "Tom" }),
   update!({ "$set": { "name": "Roy", "age": 21, "email": "test@test.com" }}),
 )
 .await?;