moleculer-db-adapter-couchdb-nano
CouchDB Nano adapter for Moleculer DB service.
Features
- Schemaless adapter
- CouchDB Nano driver v7
Install
$ npm install moleculer-db moleculer-db-adapter-couchdb-nano --save
Usage
"use strict";
const { ServiceBroker } = require("moleculer");
const DbService = require("moleculer-db");
const CouchDBAdapter = require("moleculer-db-adapter-couchdb-nano");
const broker = new ServiceBroker();
broker.createService({
name: "blog",
collection: "posts",
adapter: new CouchDBAdapter("couchdb://localhost:5984"),
mixins: [DbService]
});
broker.start()
.then(() => broker.call("posts.create", {
title: "My first post",
content: "Lorem ipsum...",
votes: 0
}))
.then(() => broker.call("posts.find").then(console.log));
Options
**Example with default connection to localhost:5984 **
new CouchDBAdapter()
Example with connection URI & options
new CouchDBAdapter("couchdb://localhost:5984", {
})
Test
$ npm test
In development with watching
$ npm run ci
License
The project is available under the MIT license.
Contact
Copyright (c) 2018 Mr. Kutin