couchdb_connector v0.4.0 Couchdb.Connector.View
The View module provides functions for basic CouchDB view handling.
Examples
db_props = %{protocol: "http", hostname: "localhost",database: "couchdb_connector_test", port: 5984}
%{database: "couchdb_connector_test", hostname: "localhost", port: 5984, protocol: "http"}
view_code = File.read!("my_view.json")
Couchdb.Connector.View.create_view db_props, "my_design", view_code
Couchdb.Connector.View.document_by_key(db_props, "design_name", "view_name", "key")
{:ok, "{\"total_rows\":3,\"offset\":1,\"rows\":[\r\n{\"id\":\"5c09dbf93fd...\", ...}
Summary
Functions
Create a view with the given JavaScript code in the given design document
Create a view with the given JavaScript code in the given design document. Admin credentials are required for this operation
Find and return one document with given key in given view. Will return a JSON document with an empty list of documents if no document with given key exists. Staleness is set to ‘update_after’
Find and return one document with given key in given view, using basic authentication. Will return a JSON document with an empty list of documents if no document with given key exists. Staleness is set to ‘update_after’ which will perform worse than ‘ok’ but deliver more up-to-date results
Find and return one document with given key in given view, using basic authentication. Will return a JSON document with an empty list of documents if no document with given key exists. Staleness is set to ‘ok’ which will perform better than ‘update_after’ but potentially deliver stale results
Find and return one document with given key in given view. Will return a JSON document with an empty list of documents if no document with given key exists. Staleness is set to ‘update_after’
Returns everything found for the given view in the given design document, using no authentication
Returns everything found for the given view in the given design document, using basic authentication
Functions
create_view(Couchdb.Connector.Types.db_properties, String.t, String.t) :: {:ok, String.t} | {:error, String.t}
Create a view with the given JavaScript code in the given design document.
create_view(Couchdb.Connector.Types.db_properties, Couchdb.Connector.Types.basic_auth, String.t, String.t) :: {:ok, String.t} | {:error, String.t}
Create a view with the given JavaScript code in the given design document. Admin credentials are required for this operation.
document_by_key(Couchdb.Connector.Types.db_properties, Couchdb.Connector.Types.view_key) :: {:ok, String.t} | {:error, String.t}
Find and return one document with given key in given view. Will return a JSON document with an empty list of documents if no document with given key exists. Staleness is set to ‘update_after’.
document_by_key(Couchdb.Connector.Types.db_properties, Couchdb.Connector.Types.view_key, :update_after) :: {:ok, String.t} | {:error, String.t}
document_by_key(Couchdb.Connector.Types.db_properties, Couchdb.Connector.Types.view_key, :ok) :: {:ok, String.t} | {:error, String.t}
document_by_key(Couchdb.Connector.Types.db_properties, Couchdb.Connector.Types.basic_auth, Couchdb.Connector.Types.view_key) :: {:ok, String.t} | {:error, String.t}
Find and return one document with given key in given view, using basic authentication. Will return a JSON document with an empty list of documents if no document with given key exists. Staleness is set to ‘update_after’ which will perform worse than ‘ok’ but deliver more up-to-date results.
document_by_key(Couchdb.Connector.Types.db_properties, Couchdb.Connector.Types.basic_auth, Couchdb.Connector.Types.view_key, :update_after) :: {:ok, String.t} | {:error, String.t}
document_by_key(Couchdb.Connector.Types.db_properties, Couchdb.Connector.Types.basic_auth, Couchdb.Connector.Types.view_key, :ok) :: {:ok, String.t} | {:error, String.t}
Find and return one document with given key in given view, using basic authentication. Will return a JSON document with an empty list of documents if no document with given key exists. Staleness is set to ‘ok’ which will perform better than ‘update_after’ but potentially deliver stale results.
Find and return one document with given key in given view. Will return a JSON document with an empty list of documents if no document with given key exists. Staleness is set to ‘update_after’.
fetch_all(Couchdb.Connector.Types.db_properties, String.t, String.t) :: {:ok, String.t} | {:error, String.t}
Returns everything found for the given view in the given design document, using no authentication.
fetch_all(Couchdb.Connector.Types.db_properties, Couchdb.Connector.Types.basic_auth, String.t, String.t) :: {:ok, String.t} | {:error, String.t}
Returns everything found for the given view in the given design document, using basic authentication.