dl

db-local

Local database using JSON to store data.

Showing:

Popularity

Downloads/wk

7

GitHub Stars

5

Maintenance

Last Commit

4mos ago

Contributors

4

Package

Dependencies

0

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

db-local npm npm npm

Local database using JSON to store data.

Installation

npm install db-local

How to use

const dbLocal = require("db-local")
const { Schema } = new dbLocal({ path: "./databases" })

const User = Schema("User", {
  _id: { type: Number },
  username: { type: String, required: true },
  bots: { type: Array, default: [{ name: "test" }] },
})

let user = User.find({ _id: 1 })

if (!user) user = User.create({ _id: 1, username: "lennart" }).save()

console.log(user)
// {
//   data: { _id: 1, username: "lennart", bots: [ { name: "test" } ] },
//   update: [Function: update],
//   remove: [Function: remove],
//   save: [Function: save]
// }

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100