Class CouchRest::Database
In: lib/couchrest/core/database.rb
Parent: Object

Methods

Attributes

bulk_save_cache_limit  [RW] 
host  [R] 
name  [R] 
root  [R] 
server  [R] 
uri  [R] 

Public Class methods

Create a CouchRest::Database adapter for the supplied CouchRest::Server and database name.

Parameters

server<CouchRest::Server>:database host
name<String>:database name

Public Instance methods

bulk_delete(docs = nil, use_uuids = true)

Alias for bulk_save

bulk_load(ids)

Alias for get_bulk

POST an array of documents to CouchDB. If any of the documents are missing ids, supply one from the uuid cache.

If called with no arguments, bulk saves the cache of documents to be bulk saved.

Compact the database, removing old document revisions and optimizing space use.

DEPRECATION NOTICE

COPY an existing document to a new id. If the destination id currently exists, a rev must be provided. dest can take one of two forms if overwriting: "id_to_overwrite?rev=revision" or the actual doc hash with a ‘_rev’ key

Create the database

DEPRECATION NOTICE

DELETE the database itself. This is not undoable and could be rather catastrophic. Use with care!

DELETE an attachment directly from CouchDB

DELETE the document from CouchDB that has the given _id and _rev.

If bulk is true (false by default) the deletion is recorded for bulk-saving (bulk-deletion :) later. Bulk saving happens automatically when bulk_save_cache limit is exceded, or on the next non bulk save.

Query the _all_docs view. Accepts all the same arguments as view.

GET an attachment directly from CouchDB

GET a document from CouchDB, by id. Returns a Ruby Hash.

load a set of documents by passing an array of ids

GET the database info from CouchDB

PUT an attachment directly to CouchDB

Delete and re create the database

Replicates via "pulling" from another database to this database. Makes no attempt to deal with conflicts.

Replicates via "pushing" to another database. Makes no attempt to deal with conflicts.

DEPRECATION NOTICE

Save a document to CouchDB. This will use the _id field from the document as the id for PUT, or request a new UUID from CouchDB, if no _id is present on the document. IDs are attached to documents on the client side because POST has the curious property of being automatically retried by proxies in the event of network segmentation and lost responses.

If bulk is true (false by default) the document is cached for bulk-saving later. Bulk saving happens automatically when bulk_save_cache limit is exceded, or on the next non bulk save.

POST a temporary view function to CouchDB for querying. This is not recommended, as you don‘t get any performance benefit from CouchDB‘s materialized views. Can be quite slow on large databases.

temp_view(funcs, params = {})

Alias for slow_view

returns the database‘s uri

Query a CouchDB view as defined by a _design document. Accepts paramaters as described in wiki.apache.org/couchdb/HttpViewApi

[Validate]