Module couchbeam

Function Index

all_dbs/1get list of databases on a CouchDB node.
all_docs/1(Deprecated.) get all documents from a CouchDB database.
all_docs/2(Deprecated.) get all documents from a CouchDB database.
compact/1Compaction compresses the database file by removing unused sections created during updates.
compact/2Like compact/1 but this compacts the view index from the current version of the design document.
create_db/2Create a database and a client for connectiong to it.
create_db/3Create a database and a client for connectiong to it.
create_db/4Create a database and a client for connectiong to it.
db_exists/2test if db with dbname exists on the CouchDB node.
db_info/1get database info.
db_request/4
db_request/5
db_request/6
db_url/1
delete_attachment/3delete a document attachment.
delete_attachment/4delete a document attachment.
delete_db/1delete database.
delete_db/2delete database.
delete_doc/2delete a document.
delete_doc/3delete a document if you want to make sure the doc it emptied on delete, use the option {empty_on_delete, true} or pass a doc with just _id and _rev members.
delete_docs/2delete a list of documents.
delete_docs/3delete a list of documents if you want to make sure the doc it emptied on delete, use the option {empty_on_delete, true} or pass a doc with just _id and _rev members.
doc_exists/2test if doc with uuid exists in the given db.
doc_url/2
ensure_full_commit/1commit all docs in memory.
ensure_full_commit/2commit all docs in memory.
fetch_attachment/3fetch a document attachment.
fetch_attachment/4fetch a document attachment.
fetch_attachment/5fetch a document attachment.
get_uuid/1Get one uuid from the server.
get_uuids/2Get a list of uuids from the server.
lookup_doc_rev/2
lookup_doc_rev/3
make_url/3
open_db/2Create a client for connection to a database.
open_db/3Create a client for connection to a database.
open_doc/2open a document.
open_doc/3open a document Params is a list of query argument.
open_or_create_db/2Create a client for connecting to a database and create the database if needed.
open_or_create_db/3Create a client for connecting to a database and create the database if needed.
open_or_create_db/4Create a client for connecting to a database and create the database if needed.
put_attachment/4put an attachment.
put_attachment/5put an attachment.
replicate/2Handle replication.
replicate/3Handle replication.
replicate/4handle Replication.
save_doc/2save a document.
save_doc/3save a document A document is a Json object like this one:.
save_docs/2save a list of documents.
save_docs/3save a list of documents.
server_connection/0Create a server for connectiong to a CouchDB node.
server_connection/2Create a server for connectiong to a CouchDB node.
server_connection/4Create a server for connectiong to a CouchDB node.
server_info/1Get Information from the server.
server_url/1Asemble the server URL for the given client.
start/0Start the couchbeam process.
stop/0Stop the couchbeam process.
stream_fetch_attachment/4stream fetch attachment to a Pid.
stream_fetch_attachment/5stream fetch attachment to a Pid.
stream_fetch_attachment/6stream fetch attachment to a Pid.
uuids_url/1
version/0Return the version of the application.
view/2(Deprecated.) get view results from database.
view/3(Deprecated.) get view results from database.

Function Details

all_dbs/1

all_dbs(Server::server()) -> {ok, iolist()}

get list of databases on a CouchDB node

all_docs/1

all_docs(Db) -> any()

Equivalent to all_docs(Db, []).

This function is deprecated: use new api in couch_view.

get all documents from a CouchDB database.

all_docs/2

all_docs(Db::db(), Options::list()) -> {ok, View::view()} | {error, term()}

This function is deprecated: use new api in couch_view.

get all documents from a CouchDB database. It return a #view{} record that you can use with couchbeam_oldview functions:

compact/1

compact(Db::db()) -> ok | {error, term()}

Compaction compresses the database file by removing unused sections created during updates. See http://wiki.apache.org/couchdb/Compaction for more informations

compact/2

compact(Db::db(), ViewName::string()) -> ok | {error, term()}

Like compact/1 but this compacts the view index from the current version of the design document. See http://wiki.apache.org/couchdb/Compaction#View_compaction for more informations

create_db/2

create_db(Server, DbName) -> any()

Equivalent to create_db(Server, DbName, [], []).

Create a database and a client for connectiong to it.

create_db/3

create_db(Server, DbName, Options) -> any()

Equivalent to create_db(Server, DbName, Options, []).

Create a database and a client for connectiong to it.

create_db/4

create_db(Server::server(), DbName::string(), Options::optionList(), Params::list()) -> {ok, db() | {error, Error}}

Create a database and a client for connectiong to it.

Connections are made to:
          http://Host:PortPrefix/DbName
If ssl is set https is used. See server_connections for options. Params is a list of optionnal query argument you want to pass to the db. Useful for bigcouch for example.

db_exists/2

db_exists(Server::server(), DbName::string()) -> boolean()

test if db with dbname exists on the CouchDB node

db_info/1

db_info(Db::db()) -> {ok, iolist() | {error, Error}}

get database info

db_request/4

db_request(Method, Url, Expect, Options) -> any()

db_request/5

db_request(Method, Url, Expect, Options, Headers) -> any()

db_request/6

db_request(Method, Url, Expect, Options, Headers, Body) -> any()

db_url/1

db_url(Db) -> any()

delete_attachment/3

delete_attachment(Db, Doc, Name) -> any()

Equivalent to delete_attachment(Db, Doc, Name, []).

delete a document attachment

delete_attachment/4

delete_attachment(Db, DocOrDocId, Name, Options) -> any()

delete a document attachment

delete_db/1

delete_db(Db) -> any()

Equivalent to delete_db(Server, DbName).

delete database

delete_db/2

delete_db(Server::server(), DbName) -> {ok, iolist() | {error, Error}}

delete database

delete_doc/2

delete_doc(Db, Doc) -> any()

Equivalent to delete_doc(Db, Doc, []).

delete a document

delete_doc/3

delete_doc(Db, Doc, Options) -> {ok, Result} | {error, Error}

delete a document if you want to make sure the doc it emptied on delete, use the option {empty_on_delete, true} or pass a doc with just _id and _rev members.

delete_docs/2

delete_docs(Db, Docs) -> any()

Equivalent to delete_docs(Db, Docs, []).

delete a list of documents

delete_docs/3

delete_docs(Db::db(), Docs::list(), Options::list()) -> {ok, Result} | {error, Error}

delete a list of documents if you want to make sure the doc it emptied on delete, use the option {empty_on_delete, true} or pass a doc with just _id and _rev members.

doc_exists/2

doc_exists(Db::db(), DocId::string()) -> boolean()

test if doc with uuid exists in the given db

doc_url/2

doc_url(Db, DocId) -> any()

ensure_full_commit/1

ensure_full_commit(Db) -> any()

Equivalent to ensure_full_commit(Db, []).

commit all docs in memory

ensure_full_commit/2

ensure_full_commit(Db::db(), Options::list()) -> {ok, term()} | {error, term()}

commit all docs in memory

fetch_attachment/3

fetch_attachment(Db, DocId, Name) -> any()

Equivalent to fetch_attachment(Db, DocId, Name, [], DEFAULT_TIMEOUT).

fetch a document attachment

fetch_attachment/4

fetch_attachment(Db, DocId, Name, Options) -> any()

Equivalent to fetch_attachment(Db, DocId, Name, Options, DEFAULT_TIMEOUT).

fetch a document attachment

fetch_attachment/5

fetch_attachment(Db::db(), DocId::string(), Name::string(), Options::list(), Timeout::infinity | integer()) -> {ok, binary()}

fetch a document attachment

get_uuid/1

get_uuid(Server::server()) -> lists()

Get one uuid from the server

get_uuids/2

get_uuids(Server::server(), Count::integer()) -> lists()

Get a list of uuids from the server

lookup_doc_rev/2

lookup_doc_rev(Db, DocId) -> any()

lookup_doc_rev/3

lookup_doc_rev(Db, DocId, Params) -> any()

make_url/3

make_url(Server, Path, Query) -> any()

open_db/2

open_db(Server, DbName) -> any()

Equivalent to open_db(Server, DbName, []).

Create a client for connection to a database

open_db/3

open_db(Server::server(), DbName::string(), Options::optionList()) -> {ok, db()}

Create a client for connection to a database

open_doc/2

open_doc(Db, DocId) -> any()

Equivalent to open_doc(Db, DocId, []).

open a document

open_doc/3

open_doc(Db::db(), DocId::string(), Params::list()) -> {ok, Doc} | {error, Error}

open a document Params is a list of query argument. Have a look in CouchDb API

open_or_create_db/2

open_or_create_db(Server, DbName) -> any()

Equivalent to open_or_create_db(Server, DbName, [], []).

Create a client for connecting to a database and create the database if needed.

open_or_create_db/3

open_or_create_db(Server, DbName, Options) -> any()

Equivalent to open_or_create_db(Server, DbName, Options, []).

Create a client for connecting to a database and create the database if needed.

open_or_create_db/4

open_or_create_db(Server::server(), DbName::string(), Options::list(), Params::list()) -> {ok, db() | {error, Error}}

Create a client for connecting to a database and create the database if needed.

put_attachment/4

put_attachment(Db, DocId, Name, Body) -> any()

Equivalent to put_attachment(Db, DocId, Name, Body, []).

put an attachment

put_attachment/5

put_attachment(Db::db(), DocId::string(), Name::string(), Body::body(), Option::optionList()) -> {ok, iolist()}

put an attachment

replicate/2

replicate(Server::server(), RepObj::{list()}) -> {ok, Result} | {error, Error}

Handle replication. Pass an object containting all informations It allows to pass for example an authentication info

  RepObj = {[
  {<<"source">>, <<"sourcedb">>},
  {<<"target">>, <<"targetdb">>},
  {<<"create_target">>, true}
  ]}
  replicate(Server, RepObj).

replicate/3

replicate(Server::server(), Source::string(), Target::target()) -> {ok, Result} | {error, Error}

Handle replication.

replicate/4

replicate(Server, Source, Target, X4) -> any()

handle Replication. Allows to pass options with source and target. Options is a Json object. ex:

  Options = {[{<<"create_target">>, true}]},
  couchbeam:replicate(S, "testdb", "testdb2", Options).

save_doc/2

save_doc(Db, Doc) -> any()

Equivalent to save_doc(Db, Doc, []).

save a document

save_doc/3

save_doc(Db::db(), Doc, Options::list()) -> {ok, Doc1} | {error, Error}

save a document A document is a Json object like this one:

          {[
           {<<"_id">>, <<"myid">>},
           {<<"title">>, <<"test">>}
       ]}
Options are arguments passed to the request. This function return a new document with last revision and a docid. If _id isn't specified in document it will be created. Id is created by extracting an uuid from the couchdb node.

save_docs/2

save_docs(Db, Docs) -> any()

Equivalent to save_docs(Db, Docs, []).

save a list of documents

save_docs/3

save_docs(Db::db(), Docs::list(), Options::list()) -> {ok, Result} | {error, Error}

save a list of documents

server_connection/0

server_connection() -> any()

Equivalent to server_connection("127.0.0.1", 5984, "", [], false).

Create a server for connectiong to a CouchDB node

server_connection/2

server_connection(Host, Port) -> any()

Equivalent to server_connection(Host, Port, "", []).

Create a server for connectiong to a CouchDB node

server_connection/4

server_connection(Host::string(), Port::integer(), Prefix::string(), Options::optionList()) -> Server::server()

Create a server for connectiong to a CouchDB node

Connections are made to:
          http://Host:PortPrefix

If ssl is set https is used.

For a description of SSL Options, look in the ssl manpage.

server_info/1

server_info(Server::server()) -> {ok, iolist()}

Get Information from the server

server_url/1

server_url(Server::{Host, Port}) -> iolist()

Asemble the server URL for the given client

start/0

start() -> any()

Start the couchbeam process. Useful when testing using the shell.

stop/0

stop() -> any()

Stop the couchbeam process. Useful when testing using the shell.

stream_fetch_attachment/4

stream_fetch_attachment(Db, DocId, Name, ClientPid) -> any()

Equivalent to stream_fetch_attachment(Db, DocId, Name, ClientPid, [], DEFAULT_TIMEOUT).

stream fetch attachment to a Pid.

stream_fetch_attachment/5

stream_fetch_attachment(Db, DocId, Name, ClientPid, Options) -> any()

Equivalent to stream_fetch_attachment(Db, DocId, Name, ClientPid, Options, DEFAULT_TIMEOUT).

stream fetch attachment to a Pid.

stream_fetch_attachment/6

stream_fetch_attachment(Db::db(), DocId::string(), Name::string(), ClientPid::pid(), Options::list(), Timeout::integer()) -> {ok, reference()} | {error, term()}

stream fetch attachment to a Pid. Messages sent to the Pid will be of the form {reference(), message()}, where message() is one of:

done
You got all the attachment
{ok, binary()}
Part of the attachment
{error, term()}
n error occurred

uuids_url/1

uuids_url(Server) -> any()

version/0

version() -> Version

Return the version of the application.

view/2

view(Db, ViewName) -> any()

Equivalent to view(Db, ViewName, []).

This function is deprecated: use new api in couch_view.

get view results from database

view/3

view(Db::db(), ViewName::string(), Options::list()) -> {ok, View::view()} | {error, term()}

This function is deprecated: use new api in couch_view.

get view results from database. viewname is generally a tupple like {DesignName::string(), ViewName::string()} or string like "designname/viewname". It return a #view{} record that you can use with couchbeam_oldview functions:

Options are CouchDB view parameters

See http://wiki.apache.org/couchdb/HTTP_view_API for more informations.


Generated by EDoc, Aug 31 2012, 10:02:31.