mungo

Functions

pub fn collection(
  db: Subject(Message),
  name: String,
) -> Collection
pub fn count(
  collection: Collection,
  filter: List(#(String, Value)),
  timeout: Int,
) -> Result(Int, Error)
pub fn count_all(
  collection: Collection,
  timeout: Int,
) -> Result(Int, Error)
pub fn delete_many(
  collection: Collection,
  filter: List(#(String, Value)),
  timeout: Int,
) -> Result(Int, Error)
pub fn delete_one(
  collection: Collection,
  filter: List(#(String, Value)),
  timeout: Int,
) -> Result(Int, Error)
pub fn find_all(
  collection: Collection,
  options: List(FindOption),
  timeout: Int,
) -> Result(Cursor, Error)
pub fn find_by_id(
  collection: Collection,
  id: String,
  timeout: Int,
) -> Result(Option(Value), Error)
pub fn find_many(
  collection: Collection,
  filter: List(#(String, Value)),
  options: List(FindOption),
  timeout: Int,
) -> Result(Cursor, Error)
pub fn find_one(
  collection: Collection,
  filter: List(#(String, Value)),
  projection: List(#(String, Value)),
  timeout: Int,
) -> Result(Option(Value), Error)
pub fn insert_many(
  collection: Collection,
  docs: List(List(#(String, Value))),
  timeout: Int,
) -> Result(InsertResult, Error)
pub fn insert_one(
  collection: Collection,
  doc: List(#(String, Value)),
  timeout: Int,
) -> Result(Value, Error)
pub fn next(
  cursor: Cursor,
  timeout: Int,
) -> #(Option(Value), Cursor)
pub fn start(
  uri: String,
  timeout: Int,
) -> Result(Subject(Message), StartError)

The connection uri must specify the database

pub fn to_list(cursor: Cursor, timeout: Int) -> List(Value)
pub fn update_many(
  collection: Collection,
  filter: List(#(String, Value)),
  change: List(#(String, Value)),
  options: List(UpdateOption),
  timeout: Int,
) -> Result(UpdateResult, Error)
pub fn update_one(
  collection: Collection,
  filter: List(#(String, Value)),
  change: List(#(String, Value)),
  options: List(UpdateOption),
  timeout: Int,
) -> Result(UpdateResult, Error)
Search Document