Module mongo_api

Api helper module.

Copyright © (C) 2016, <COMPANY>

Authors: tihon.

Description

Api helper module. You can use it as an example for your own api to mongoc, as not all parameters are passed.

Data Types

collection()

collection() = binary() | atom()

cursor()

cursor() = pid()

projector()

projector() = bson:document() | map()

selector()

selector() = map() | bson:document()

Function Index

connect/4
insert/3
update/5
delete/3
find/4
find/6
find_one/4
find_one/5
count/4
ensure_index/3Creates index on collection according to given spec.
disconnect/1

Function Details

connect/4

connect(Type::atom(), Hosts::list(), TopologyOptions::proplists:proplist(), WorkerOptions::proplists:proplist()) -> {ok, pid()}

insert/3

insert(Topology::atom() | pid(), Collection::collection(), Document::list() | map() | bson:document()) -> {{boolean(), map()}, list()}

update/5

update(Topology::atom() | pid(), Collection::collection(), Selector::selector(), Doc::map(), Opts::map()) -> {boolean(), map()}

delete/3

delete(Topology::atom() | pid(), Collection::collection(), Selector::selector()) -> {boolean(), map()}

find/4

find(Topology::atom() | pid(), Collection::collection(), Selector::selector(), Projector::projector()) -> {ok, cursor()} | []

find/6

find(Topology::atom() | pid(), Collection::collection(), Selector::selector(), Projector::projector(), Skip::integer(), Batchsize::integer()) -> {ok, cursor()} | []

find_one/4

find_one(Topology::atom() | pid(), Collection::collection(), Selector::selector(), Projector::projector()) -> map() | undefined

find_one/5

find_one(Topology::atom() | pid(), Collection::collection(), Selector::selector(), Projector::projector(), Skip::integer()) -> map() | undefined

count/4

count(Topology::atom() | pid(), Collection::collection(), Selector::selector(), Limit::integer()) -> integer()

ensure_index/3

ensure_index(Topology::pid() | atom(), Coll::collection(), IndexSpec::bson:document()) -> ok | {error, any()}

Creates index on collection according to given spec. The key specification is a bson documents with the following fields: key :: bson document, for e.g. {field, 1, other, -1, location, 2d}, required

disconnect/1

disconnect(Topology::atom() | pid()) -> ok


Generated by EDoc