mungo/crud
Types
pub type FindOption {
Skip(Int)
Limit(Int)
BatchSize(Int)
Sort(List(#(String, bson.Value)))
Projection(List(#(String, bson.Value)))
}
Constructors
-
Skip(Int)
-
Limit(Int)
-
BatchSize(Int)
-
Sort(List(#(String, bson.Value)))
-
Projection(List(#(String, bson.Value)))
pub type InsertResult {
InsertResult(inserted: Int, inserted_ids: List(bson.Value))
}
Constructors
-
InsertResult(inserted: Int, inserted_ids: List(bson.Value))
pub type UpdateOption {
Upsert
ArrayFilters(List(List(#(String, bson.Value))))
}
Constructors
-
Upsert
-
ArrayFilters(List(List(#(String, bson.Value))))
pub type UpdateResult {
UpdateResult(
matched: Int,
modified: Int,
upserted: List(bson.Value),
)
}
Constructors
-
UpdateResult( matched: Int, modified: Int, upserted: List(bson.Value), )
Functions
pub fn count(
collection: Collection,
filter: List(#(String, Value)),
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 update_many(
collection: Collection,
filter: List(#(String, Value)),
change: List(#(String, Value)),
options: List(UpdateOption),
timeout: Int,
) -> Result(UpdateResult, Error)
for more information, see here
pub fn update_one(
collection: Collection,
filter: List(#(String, Value)),
change: List(#(String, Value)),
options: List(UpdateOption),
timeout: Int,
) -> Result(UpdateResult, Error)
for more information, see here