couchdb_connector v0.5.0 Couchdb.Connector.Reader

The Reader module provides functions to retrieve documents or uuids from CouchDB.

Examples

db_props = %{protocol: "http", hostname: "localhost",database: "couchdb_connector_test", port: 5984}
%{database: "couchdb_connector_test", hostname: "localhost", port: 5984, protocol: "http"}

Couchdb.Connector.Reader.get(db_props, "_not_there_")
{:error, "{\"error\":\"not_found\",\"reason\":\"missing\"}\n"}

Couchdb.Connector.Reader.get(db_props, "ca922a07263524e2feb5fe398303ecf8")
{:ok,
  "{\"_id\":\"ca922a07263524e2feb5fe398303ecf8\",\"_rev\":\"1-59414...\",\"key\":\"value\"}\n"}

Couchdb.Connector.Reader.fetch_uuid(db_props)
{:ok, "{\"uuids\":[\"1a013a4ce3...\"]}\n"}

Summary

Functions

Fetch a single uuid from CouchDB for use in a a subsequent create operation. This operation requires no authentication

Retrieve the document given by database properties and id

Functions

fetch_uuid(db_props)
fetch_uuid(Couchdb.Connector.Types.db_properties) ::
  {:ok, String.t} |
  {:error, String.t}

Fetch a single uuid from CouchDB for use in a a subsequent create operation. This operation requires no authentication.

get(db_props, id)

Retrieve the document given by database properties and id.