Skip to content
This repository has been archived by the owner on Nov 5, 2018. It is now read-only.

Commit

Permalink
Changes to documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
dscape committed Aug 15, 2011
1 parent fc9a1f1 commit 7d9c7b8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 27 deletions.
47 changes: 21 additions & 26 deletions README.md
@@ -1,6 +1,6 @@
# nano

`nano` (short for nanocouch) is a minimalistic `couchdb` driver for `node.js`.
`nano` (short for nanocouch) is a minimalistic `couchdb` driver for `node.js`

## instalation

Expand All @@ -9,23 +9,23 @@

## usage

a quick example on using `nano`.
a quick example on using `nano`

in `nano` callback always return three arguments:

err: the error, if any. check error.js for more info.
headers: the http response headers from couchdb, if no error.
response: the http response body from couchdb, if no error.

to use `nano` you have to either provide a) a `json` `configuration object` or b) a `configuration file path` like `cfg/tests.js`. refer to [cfg/couch.example.js][4] for a example.
to use `nano` you have to either provide a) a `json` `configuration object` or b) a `configuration file path` like `cfg/tests.js`. refer to [cfg/couch.example.js][4] for a example

var nano = require('nano')('./cfg/tests.js');

within the `nano` variable you have various methods you can call. these include tasks like create, delete or list databases:

nano.db.create("alice");

in this function there is not callback. in `nano` the absence of callback means "do this, ignore what happens".
in this function there is not callback. in `nano` the absence of callback means "do this, ignore what happens"

you normally don't want to do that though:

Expand All @@ -41,16 +41,15 @@ you normally don't want to do that though:
});
});

the `alicedb.use` method creates a `scope` where you operate inside a single database. this is just a convenience so you don't have to specify the database name every single time you do an update or delete.
the `alicedb.use` method creates a `scope` where you operate inside a single database. this is just a convenience so you don't have to specify the database name every single time you do an update or delete

don't forget to delete the database you created:

nano.db.destroy("alice");

## interfaces

`*` marks optional.
`&` marks aliases.
`*` marks optional

### databases (nano)

Expand All @@ -72,30 +71,27 @@ don't forget to delete the database you created:

### documents (nano.use)

`nano.use` simply sets `db_name` in scope. this way you don't have to specify it every time.

#### functions

`db.insert(doc_name*,doc,callback*)`
`db.update(doc_name,rev,doc,callback*)`
`db.destroy(doc_name,rev,callback*)`
`db.get(doc_name,callback*)`
`db.list(callback*)`
`db.info`

#### aliases

please remember `db_name` is already in scope so there no need to specify it.
`nano.use` simply sets `db_name` in scope. this way you don't have to specify it every time

`nano.db.get > [db.info(callback*)]`
`nano.db.replicate > [db.replicate(target,continuous*,callback*)]`
`nano.db.compact > [db.compact(callback*)]`

### advanced users
### advanced

`nano` is minimalistic so it provides advanced users with a way to code their own functions:
`nano` is minimalistic so it provides advanced users with a way to code their own extension functions:

nano.request(opts,callback)
nano.request(opts,callback*)

e.g. in `nano` there is no way for you to get a document in a specific revision. an advanced users would do:

Expand All @@ -107,9 +103,7 @@ e.g. in `nano` there is no way for you to get a document in a specific revision.
function (_,_,b) { console.log(b) }
);

## future plans

roadmap:
## roadmap

1. add `pipe` support as provided by request
2. explore adding `_changes` feed
Expand All @@ -121,32 +115,33 @@ roadmap:

## contribute

everyone is welcome to contribute. patches, bugfixes, new features.
everyone is welcome to contribute. patches, bugfixes, new features

1. create an issue to know if the feature is wanted and state that you are interested in fixing it yourself.
1. create an [issue][2] on github so the community can comment on your idea
2. fork `nano` in github
3. create a new branch - `git checkout -b my_branch`
3. create a new branch `git checkout -b my_branch`
4. create tests for the changes you made
5. make sure you pass both existing and newly inserted tests
6. commit your changes
7. push to your branch - `git push origin my_branch`
7. push to your branch `git push origin my_branch`
8. create an pull request

### running the tests
### tests

1. install the packages referred as dev dependencies in `package.json`.
2. browse to `test/` and `./run`.
1. install the packages referred as dev dependencies in `package.json`
2. browse to `test/` and `./run`.

always make sure all the tests pass before sending in your pull request!
we will tell santa!

we will tell santa

## meta

_
/ _) ROAR! i'm a vegan!
.-^^^-/ /
__/ /
/__.|_|-|_| cannes est superb!
/__.|_|-|_| cannes est superb

* code: `git clone git://github.com/dscape/nano.git`
* home: <http://github.com/dscape/nano>
Expand Down
2 changes: 1 addition & 1 deletion nano.js
Expand Up @@ -295,7 +295,7 @@ module.exports = exports = nano = function database_module(cfg) {
, scope: document_module // Alias
, request: relax
, relax: relax // Alias
, dinosaur: relax
, dinosaur: relax // Alias
};
return public_functions;
};
Expand Down

0 comments on commit 7d9c7b8

Please sign in to comment.