You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
1 year ago | |
|---|---|---|
| .. | ||
| lib | 1 year ago | |
| node_modules/lodash | 1 year ago | |
| src | 1 year ago | |
| test | 1 year ago | |
| .npmignore | 1 year ago | |
| .travis.yml | 1 year ago | |
| Cakefile | 1 year ago | |
| README.md | 1 year ago | |
| index.js | 1 year ago | |
| package.json | 1 year ago | |
README.md
JugglingDB-Nano 
CouchDB-nano adapter for jugglingdb.
Usage
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'}); ...
Working with your database
Automatic creation of views for indexes
This adapter will automatically create several design documents on your database:
\_design/nanodocument containsby\_modelview that maps documents to their model property, if such exists.- For each model that has at least one property with
indexed: trueit will create one design document named\_design/nano-<model name>and one view namedby\_<property name>for each indexed property.
Automatic use of created views
During querying of database this adapter will:
- Try to automatically leverage the views it created if an indexed property is used in
where. - Fallback to using
nano/\_by_modelview to reduce the number of documents it has to scan.
Query parameters
- All queries to the database use
include_docsset totrue - jugglingdb's
offsetis used asskipquery parameter - jugglingdb's
limitis used aslimitquery parameter
Known issues
- jugglingdb's
findOne(and methods that depend on it) has to be used only for keys with unique indexes as it passeslimitof 1 to the adapter which then retrieves just the first document in the view which may or may not match the otherwhereconditions.
Running tests
Make sure you have couchdb server running on default port
npm test
Contributing
Please make changes to files in the src folder and then compile with cake build before sending a pull request.
MIT License
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.