maxdb
v1.1.0
Published
MaxDB is lightweight NodeJS database.
Downloads
13
Maintainers
Readme
MaxDB
MaxDB is lightweight NodeJS database.
Installation
Use the package manager npm to install maxdb.
npm install maxdb
Usage
const MaxDB = require("maxdb") // importing
MaxDB.login('admin', 'admin') // logining in (username, password). You can change password or username at settings.json file in node_modules\tinydb folder
MaxDB.init() // connecting to db
MaxDB.set('users', 'user1', {
status: 'online',
birth: '24.05.1999',
name: 'John Smith'
}) // creating user1 document in users collection (if collection don't exist it will create it.) with data (status, birth, name)
// ... more users ...
console.log("Online users")
MaxDB.getWhere('users', 'status', '==', 'online').forEach(user => {
console.log(`User ${user.name} is curently ${user.status}`)
}) // getting all users which status is online from users collection
console.log("Offline users")
MaxDB.getWhere('users', 'status', '!=', 'online').forEach(user => {
console.log(`User ${user.name} is curently ${user.status}`)
}) // getting all users which status isn't online from users collection
console.log(MaxDB.get('users', 'user1')) // getting document user1 from users collection
Admin Panel
When you start application that use MaxDB. MaxDB will bind to localhost:2137 Database admin panel. It's beta version and isn't super expanded.
Small MaxDB Project
https://github.com/maciej-debowski/maxdb-test