Giter VIP home page Giter VIP logo

rcouchdb's Introduction

R-couchDB

Travis-CI Build Status Coverage Status CRAN Status Badge

R interface to the CouchDB database

Description

This package contains various functions for interacting with couchDB - a document database. For more information about the couchDB database see Apache Couchdb or the implementation by IBM as IBM Cloudant.

Usage

Install the package from latest CRAN with install.package("couchDB").

Get connected

To interact with a couchDB instance you will need to create a connection object. Communication with couchDB happens over a http protocol. A minimal connection (running on the default port and no password protection) would be:

myConn <- couch_http_connection("localhost")

The variable myConn can now be used as parameters to other functions.

For convenience a default connection can also be created with couch_set_default_connection using the same parameters.

Once a connection object exists, you may want to make sure it is connecting correctly with the couch_ping function. If you are properly connected the reponse should be something like:

Response [http://localhost:5984]
Status: 200
Content-type: text/plain; charset=utf-8
Size: 151 B
{"couchdb":"Welcome","uuid":"c1a367c91517195b57ddafe788a72b75","version":"1.4.0","vendor"
{"name":"...

To connect to cloudant specify the service (otherwise it defaults to couchdb) as follows:

myConn <- couch_http_connection(host = "demo.cloudant.com",
                                https = TRUE,
                                service = "cloudant")
Response [https://demo.cloudant.com/]
  Date: 2016-05-13 16:50
  Status: 200
  Content-Type: application/json
  Size: 64 B
{"couchdb":"Welcome","version":"1.0.2","cloudant_build":"2580"}

Databases

On a couchDB install there can be several databases (i.e. namespaces). The function couch_list_databases will provide a list of available databases on the connection provided.

The function couch_create_database will, similarly, allow you to create a new database or namespace on the couchDB instance.

Fetch, store and delete documents

Once you have a connection and a database to work with you can fetch, store and delete documents by using the corresponding functions:

couch_fetch() and couch_fetch_default()

couch_store() and couch_store_default()

couch_delete()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.