Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

couchdb

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

couchdb

  • 0.2.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= 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

Package last updated on 19 Oct 2011

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc