Skip to content
This repository has been archived by the owner on Jan 19, 2024. It is now read-only.

Latest commit

 

History

History
94 lines (63 loc) · 3.17 KB

README.md

File metadata and controls

94 lines (63 loc) · 3.17 KB

reduxdb

Redux with MongoDB-like API.

Notice that NOT all the features of MongoDB are implemented here, such as multi-index and query operators.

The purpose of reduxdb is to avoid writing almost the same actions and stores again and again in different projects.

Installation

npm install --save reduxdb

Usage

var reduxdb = require("reduxdb")

var db = reduxdb.use("test")
db.createCollection("users", {index: "id"})
db.createCollection("teams", {index: "id"})
db.createCollection("books")    // using default index `_id`

db.subscribe(function() {
    console.log(db.stats())
    console.log(db.users.stats())
    console.log(db.teams.stats())
    console.log(db.books.stats())
})

db.users.insert({id: "1234", name: "wizawu"})
db.users.findOne({name: "wizawu"}).id    // 1234

API

reduxdb

  • use(name)

reduxdb.DB

reduxdb.Collection