Macro memquery::doc[][src]

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

Construct a serde_json::Value from a JSON literal representing document.

This is equivalent to serde_json::json but also adds _id field with uuid

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

async fn play() -> Result<(), Error> {
  let memdb = MemDb::new();
  let coll = memdb.collection("TestCollection").await?;

  coll.insert(doc!({ "name": "Tom", "age": 25 })).await?;
  Ok(())
}