Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
= A straight-forward client for CouchDB REST API
The intend of this project is to provide a plain, straight-forward abstraction of the CouchDB REST API. The resources exposed by the API are simply wrapped into classes.
{}[http://travis-ci.org/phifty/couchdb]
== An example
server = CouchDB::Server.new "localhost", 5984 database = CouchDB::Database.new server, "test" database.delete_if_exists! database.create_if_missing!
document_one = CouchDB::Document.new database, "_id" => "test_document_1", "category" => "one" document_one.save
document_two = CouchDB::Document.new database, "_id" => "test_document_2", "category" => "two" document_two.save
design = CouchDB::Design.new database, "design_1" view = CouchDB::Design::View.new design, "view_1", "function(document) { emit([ document['category'], document['_id'] ]); }" design.save
collection = view.collection :startkey => [ "one", nil ], :endkey => [ "one", { } ] collection.total_count # => 2 collection.size # => 1 collection[0].id # => "test_document_1" collection[0].key # => [ "one", "test_document_1" ] collection[0].value # => nil
collection.documents.include? document_one # => true collection.documents.include? document_two # => false
This example creates a database on the local CouchDB server (if it's missing) and stores two documents in it. It also creates a design document with a view, that makes it possible to select the results by the document's category.
The collection call on that view, returns a subset of the results, by defining a start- and an endkey. The collection object itself acts as a proxy to the results. This first request of it's content will actually fetch the data from the server.
If the results are accessed by the documents proxy, the include_docs parameter will be passed to the server and the delivered document hashes will be returned as an array of document (CouchDB::Document) objects.
== Development
This project is still under development. Any bug report and contribution is welcome!
== Support
Apart from contribution, support via Flattr[http://flattr.com/thing/108993/A-straight-forward-client-for-CouchDB-REST-API] is welcome.
FAQs
Unknown package
We found that couchdb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.