GithubHelp home page GithubHelp logo

nedb-party's Introduction

nedb-party

A library for making nedb multi-process capable.

Basically, it'll check to see if another process has the db locked, if it does, it'll send requests to that process, through rpc, to perform change operations.

Note: Only methods that receive callbacks are supported. It does not yet support event methods .on, etc.

This idea is inspired heavily by substack's level-party npm package.

Installation

npm install --save nedb-party

Example Usage

var Datastore = require('nedb-party')

var options = {filename: __dirname + '/example.db'}

var db1 = new Datastore(options)

// in the same process or not
var db2 = new Datastore(options)

db1.insert({hello: "World"), function(err, newDoc) {
  console.log('inserted doc:', newDoc)
});

db1.insert({hello: "Moon"), function(err, newDoc2) {
  console.log('inserted doc:', newDoc2)
});

nedb-party's People

Contributors

allain avatar

Stargazers

wangshijun avatar Sam Denty avatar  avatar Vladimir Angelov avatar Emanuele Antonelli avatar Cuixiping avatar Aaron avatar Jon Ferguson avatar David Luu avatar

Watchers

 avatar James Cloos avatar

Forkers

vangelov

nedb-party's Issues

nedb-pary keeps script from closing

Hi. I have a simple script for inserting, modifying, and deleting JSON files to my database, which makes use of this module. I've noticed it causes the script to hang even after everything has been executed. I'm wondering what I should do about this as I don't want to manually close the script with SIGINT every time I use it.

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.