CouchDB-nano adapter for jugglingdb.
To use it you need jugglingdb@0.2.x
.
Setup dependencies in package.json
:
{
...
"dependencies": {
"jugglingdb": "0.2.x",
"jugglingdb-nano": "latest"
},
...
}
Use:
var Schema = require('jugglingdb').Schema;
var schema = new Schema('nano', {url: 'http://localhost:5984/nano-test'});
...
This adapter will automatically create several design documents on your database:
\_design/nano
document contains by\_model
view that maps documents to their model property, if such exists.indexed: true
it will create one design document named \_design/nano-<model name>
and one view named by\_<property name>
for each indexed property.During querying of database this adapter will:
where
.nano/\_by_model
view to reduce the number of documents it has to scan.include_docs
set to true
offset
is used as skip
query parameterlimit
is used as limit
query parameterfindOne
(and methods that depend on it) has to be used only for keys with unique indexes as it passes limit
of 1 to the adapter which then retrieves just the first document in the view which may or may not match the other where
conditions.Make sure you have couchdb server running on default port
npm test
Please make changes to files in the src
folder and then compile with cake build
before sending a pull request.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.