Rust

document

Module

[Document]: an ordered set of attributes, with the system attributes ($id, $sequence, $collection, $tenant, $createdAt, $updatedAt, $permissions) every stored document has.

Contents

use utopia_database::Document;
Rust
pub struct Document

A document: attributes in insertion order, each a Value. Nested documents (relationships) are Value::Ext with Ext::Document.

Rust
use utopia_database::{Document, value::string};

let mut doc = Document::from_pairs([("$id", string("movie1")), ("name", string("Alien"))]).unwrap();
assert_eq!(doc.id(), "movie1");
doc.set("year", 1979.into());
assert_eq!(doc.get("year"), Some(&1979.into()));
assert!(doc.remove("name").is_some());
use utopia_database::document::SetType;
Rust
pub enum SetType

How Document::set_with stores a value.

Rust
pub const CLASS: &str = "Utopia\\Database\\Document"

Undocumented.