Fast and advanced, document based and key-value based NoSQL database that able to work as it is installed.

Overview

About

Fast and advanced, document based and key-value based NoSQL database that able to work as it is installed.

Features

  • NoSQL database
  • Can be run as it is installed
  • Can be used document based and key-value based
  • Customizable settings for collections
  • No need to use schema
  • Quick data reading and writing
  • Data can be kept in cache
  • Easy to find data
  • Automatically or manual backup

Latest Updates

v2.0.2 → v2.1.0

  • <Collection>.Has() added. You can check if a data exists. It can be used in both types of collections.

v1.3.1 → v2.0.0

  • Added new collection type. You can now use your data on key-value based. Thanks to the newly added key-value based collection type, you do not have to keep your data in a document based format.
  • Added find and filter with JSON. In your document based collection, you can also use JSON for find and filter operations instead of functions. You can find more information in document based collection examples.
  • Data read and write optimized. Your data has been rendered faster and unnecessary RAM loss has been prevented.
  • CollectionOptions.Type added. This allows you to specify type of your collection. Valid values: DOCUMENT_BASED and KEY_VALUE_BASED
  • CollectionOptions.Activate_Destroy_Function added. If this is active, the <Collection>.Destroy() function becomes operable. This command serves to destroy your collection completely. It is a dangerous command.
  • <Collection>.Set() added. This allows you to set a data to your key-value based collection.
  • <Collection>.Get() added. This allows you to get a data into your key-value based collection.
  • <Collection>.Push() added. This allows you to push a data to Array in your key-value based collection.
  • <Collection>.Remove() added. This allows you to remove a data from Array in your key-value based collection.
  • <Collection>.Increase() added. This allows you to increase number in your key-value based collection.
  • <Collection>.Reduce() added. This allows you to reduce number in your key-value based collection.
  • <Collection>.Destroy() added. This serves to completely destroy the data in your collection. You need to activate it with the activate_destroy_function option.

... see all

Installation

npm install peak.db

Usage

Creating a Collection

const PeakDB = require("peak.db");
const example_collection = new PeakDB.Collection({
  /*
    == CollectionOptions
  */
  
  "name": "EXAMPLE_COLLECTION", // Name of collection (required)
  "type": "DOCUMENT_BASED or KEY_VALUE_BASED", // IMPORTANT: Type of the collection, which cannot be changed again later. (required)
  
  /*
    For document based collections
  */
  "id_length": 32, // This determines the length of unique identities given to documents. (no required, default: 32)
  "indicate_created_at": false, // If this is active, will be automatically specified date when documents are created. (no required, default: false)
  "indicate_created_timestamp": false, // If this is active, will be automatically specified timestamp when documents are created. (no required, default: false)
  "indicate_updated_at": false, // If this is active, will be automatically specified date when documents are updated. (no required, default: false)
  "indicate_updated_timestamp": false, // If this is active, will be automatically specified timestamp when documents are updated. (no required, default: false)
  
  /*
    Can be used on all collection types
  */
  "save_timeout": 1, // (SECONDS) This specifies how many seconds after a document is inserted, the collection will be saved. This way it limits the successive saving of the collection when many data are inserted in succession, so the system is not slowed down. Data loss may occur if the system is turned off after repeatedly entering data. When the document is added 5 times in a row, the collection is saved so that the data does not remain unsaved for a long time. This can be edited with the 'save_directly_after' option. (no required, default: 1)
  "save_directly_after": 5, // (INSERT COUNT) This specifies that after how many documents have been inserted, the collection will be saved without the save timeout. (no required, default: 5)
  "cache_retention_time": 10, // (MINUTES) [If this value is -1, the cache is kept indefinitely] This indicates how much the cache will be held if the caching is enabled. If there is no activity in the collection, the cache is deleted, this prevents the loss of unnecessary RAM. (no required, default: 10)
  "backup_retention_time": 3, // (DAYS) [If this value is -1, backups will never be deleted] This determines after how many days the backups will be deleted. (no required, default: 3)
  "caching": false, // IMPORTANT: If this is active, the data is kept in the cache. In this case, the data is processed quickly, but the size of the collection is the loss of RAM. Is not preferred for large collections. (no required, default: false)
  "auto_backup": false, // If this is active, this collection will receive automatic backups. (no required, default: false)
  "detailed_debugger_logs": false, // If this is active, it will print more events in the collection to the console. (no required, default: false)
  "activate_destroy_function": false // IMPORTANT: If this is active, the '<Collection>.Destroy()' function becomes operable. This command serves to destroy your collection completely. It is a dangerous command. (no required, default: false)
});

Examples for Document Based Collections

const PeakDB = require("peak.db");
const accounts = new PeakDB.Collection({"name": "ACCOUNTS", "type": "DOCUMENT_BASED", ...options});

// Insert a Document
accounts.insert({"email": "[email protected]", "username": "fir4tozden", "password": "12345678", "region": "Muğla"});
/*
  {
    "_id": "RMmXZVDfQrVLQwFlquMPb98XNUCxQ6MM",
    "_updated": false,
    "_created_at": 2022-03-20T00:00:00.000Z,
    "_created_timestamp": 1647745200000,
    "email": "[email protected]",
    "username": "fir4tozden",
    "password": "12345678",
    "region": "Muğla"
  }
*/

// Find a Document
accounts.find(document => document.email === "[email protected]");
// or
accounts.find({"email": "[email protected]"});
/*
  {
    "_id": "RMmXZVDfQrVLQwFlquMPb98XNUCxQ6MM",
    "_updated": false,
    "_created_at": 2022-03-20T00:00:00.000Z,
    "_created_timestamp": 1647745200000,
    "email": "[email protected]",
    "username": "fir4tozden",
    "password": "12345678",
    "region": "Muğla"
  }
*/

// Filter Documents
accounts.filter(document => document.region === "Muğla");
// or
accounts.filter({"region": "Muğla"});
/*
  [
    {
      "_id": "RMmXZVDfQrVLQwFlquMPb98XNUCxQ6MM",
      "_updated": false,
      "_created_at": 2022-03-20T00:00:00.000Z,
      "_created_timestamp": 1647745200000,
      "email": "[email protected]",
      "username": "fir4tozden",
      "password": "12345678",
      "region": "Muğla"
    },
    {
      "_id": "23ERK9fHqiH_n83fhzU7eOYtzz6tUl7S",
      "_updated": false,
      "_created_at": 2022-03-20T00:05:00.000Z,
      "_created_timestamp": 1647734700000,
      "email": "[email protected]",
      "username": "nehir",
      "password": "12345678",
      "region": "Muğla"
    }
  ]
*/

// Check if Document Exists
accounts.has(document => document.email === "[email protected]");
// or
accounts.has({"email": "[email protected]"});
// true

// Update a Document
let document = accounts.find(document => document.email === "[email protected]");
accounts.update(document._id, {"email": "[email protected]", "username": "hey_im_fir4tozden", "password": "87654321", "region": "İstanbul"});
/*
  {
    "_id: "23ERK9fHqiH_n83fhzU7eOYtzz6tUl7S",
    "_updated": true,
    "_created_at": 2022-03-20T00:00:00.000Z,
    "_created_timestamp": 1647745200000,
    "_updated_at": 2022-03-20T00:10:00.000Z,
    "_updated_timestamp": 1647735000000,
    "email": "[email protected]",
    "username": "hey_im_fir4tozden",
    "password": "87654321",
    "region": "İstanbul"
  }
*/

// Delete a Document
let document = accounts.find(document => document.email === "[email protected]");
accounts.delete(document._id);
// true

Examples for Key-Value Based Collections

const PeakDB = require("peak.db");
const user_settings = new PeakDB.Collection({"name": "USER_SETTINGS", "type": "KEY_VALUE_BASED", ...options});

// Set a Data
user_settings.set("USER_1", {"friend_requests": true}); // -> {"friend_requests": true}
user_settings.set("USER_1.direct_messages", false); // -> {"friend_requests": true, "direct_messages": false}

// Get a Data
user_settings.get("USER_1"); // -> {"friend_requests": true, "direct_messages": false}
user_settings.get("USER_1.direct_messages"); // -> false

// Push a Data to Array
user_settings.push("USER_1.hobbies", "Watching TV"); // -> {"friend_requests": true, "direct_messages": false, "hobbies": ["Watching TV"]}
user_settings.push("USER_1.hobbies", "Reading Book"); // -> {"friend_requests": true, "direct_messages": false, "hobbies": ["Watching TV", "Reading Book"]}

// Remove a Data from Array
user_settings.remove("USER_1.hobbies", "Watching TV"); // -> {"friend_requests": true, "direct_messages": false, "hobbies": ["Reading Book"]}

// Check if Data Exists
user_settings.has("USER_1.hobbies"); // -> true
user_settings.has("USER_1.hobbies", "Watching TV"); // -> false

// Increase Number
user_settings.increase("USER_1.age", 15); // -> {"friend_requests": true, "direct_messages": false, "hobbies": ["Reading Book"], "age": 15}
user_settings.increase("USER_1.age", 1); // -> {"friend_requests": true, "direct_messages": false, "hobbies": ["Reading Book"], "age": 16}

// Reduce Number
user_settings.reduce("USER_1.age", 5); // -> {"friend_requests": true, "direct_messages": false, "hobbies": ["Reading Book"], "age": 11}

// Delete a Data
user_settings.delete("USER_1.direct_messages"); // -> {"friend_requests": true, "hobbies": ["Reading Book"], "age": 11}

Backup Collection

<Collection>.backup();
// true

Destroy Collection DANGEROUS

<Collection>.destroy();
// true

License

MIT

You might also like...

Azure Data Studio is a data management tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.

Azure Data Studio is a data management tool that enables you to work with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.

Azure Data Studio is a data management tool that enables working with SQL Server, Azure SQL DB and SQL DW from Windows, macOS and Linux.

Dec 31, 2022

MongoDB object modeling designed to work in an asynchronous environment.

MongoDB object modeling designed to work in an asynchronous environment.

Mongoose Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment. Mongoose supports both promises and callbacks. Do

Dec 30, 2022

O Projeto RENOVA é um e-commerce que visa ajudar no contato de pessoas interessadas em reciclagem com os itens de potencial reciclavel. Work in progress.

O Projeto RENOVA é um e-commerce que visa ajudar no contato de pessoas interessadas em reciclagem com os itens de potencial reciclavel.  Work in progress.

Descrição Nest framework TypeScript starter repository. Instalação $ npm install Rodando o app # development $ npm run start # watch mode $ npm run s

Dec 15, 2022

The Blog system developed by nest.js based on node.js and the database orm used typeorm, the development language used TypeScript

 The Blog system developed by nest.js based on node.js and the database orm used typeorm, the development language used TypeScript

考拉的 Nest 实战学习系列 readme 中有很多要说的,今天刚开源还没来及更新,晚些慢慢写,其实本人最近半年多没怎么写后端代码,主要在做低代码和中台么内容,操作的也不是原生数据库而是元数据Meta,文中的原生数据库操作也当作复习下,数据库的操作为了同时适合前端和Node开发小伙伴,所以并不是很

Dec 22, 2022

Realtime database backend based on Operational Transformation (OT)

Realtime database backend based on Operational Transformation (OT)

This README is for [email protected]. For [email protected], see the 1.x-beta branch. To upgrade, see the upgrade guide. ShareDB ShareDB is a realtime databa

Dec 29, 2022

Senior Design Project. Water intake tracker. Software for the communication to bottle and app. Software for app and database

WaterMate Senior Design Project. Water intake tracker to provide everyone with an easy to use water tracking system that can be integrated with your f

Nov 10, 2021

⚡️ lowdb is a small local JSON database powered by Lodash (supports Node, Electron and the browser)

Lowdb Small JSON database for Node, Electron and the browser. Powered by Lodash. ⚡ db.get('posts') .push({ id: 1, title: 'lowdb is awesome'}) .wri

Dec 30, 2022

Execute one command (or mount one Node.js middleware) and get an instant high-performance GraphQL API for your PostgreSQL database!

Execute one command (or mount one Node.js middleware) and get an instant high-performance GraphQL API for your PostgreSQL database!

PostGraphile Instant lightning-fast GraphQL API backed primarily by your PostgreSQL database. Highly customisable and extensible thanks to incredibly

Jan 4, 2023

🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️

🍉 Reactive & asynchronous database for powerful React and React Native apps ⚡️

A reactive database framework Build powerful React and React Native apps that scale from hundreds to tens of thousands of records and remain fast ⚡️ W

Jan 5, 2023
Realm is a mobile database: an alternative to SQLite & key-value stores

Realm is a mobile database that runs directly inside phones, tablets or wearables. This project hosts the JavaScript versions of Realm. Currently we s

Realm 5.1k Jan 3, 2023
AlaSQL.js - JavaScript SQL database for browser and Node.js. Handles both traditional relational tables and nested JSON data (NoSQL). Export, store, and import data from localStorage, IndexedDB, or Excel.

Please use version 1.x as prior versions has a security flaw if you use user generated data to concat your SQL strings instead of providing them as a

Andrey Gershun 6.1k Jan 9, 2023
Simple key-value storage with support for multiple backends

Simple key-value storage with support for multiple backends Keyv provides a consistent interface for key-value storage across multiple backends via st

Luke Childs 2k Jan 7, 2023
🔥 Dreamy-db - A Powerful database for storing, accessing, and managing multiple database.

Dreamy-db About Dreamy-db - A Powerful database for storing, accessing, and managing multiple databases. A powerful node.js module that allows you to

Dreamy Developer 24 Dec 22, 2022
DolphinDB JavaScript API is a JavaScript library that encapsulates the ability to operate the DolphinDB database, such as: connecting to the database, executing scripts, calling functions, uploading variables, etc.

DolphinDB JavaScript API English | 中文 Overview DolphinDB JavaScript API is a JavaScript library that encapsulates the ability to operate the DolphinDB

DolphinDB 6 Dec 12, 2022
Lovefield is a relational database for web apps. Written in JavaScript, works cross-browser. Provides SQL-like APIs that are fast, safe, and easy to use.

Lovefield Lovefield is a relational database written in pure JavaScript. It provides SQL-like syntax and works cross-browser (currently supporting Chr

Google 6.8k Jan 3, 2023
Database in JSON, fast and optimize

?? Database-Dev ?? DevNetwork#2103 ?? V 1.0.0 ?? Dependence Libs use ?? NodeJs V 16.14.2 (NodeJs) ?? fs (nodeFS) ?? Use libs import the file in your p

DevNetwork™️ 3 Apr 21, 2022
A postgraphile plugin that allows you to expose only a single direction of connections exposed by foreign key constraints

A postgraphile plugin that allows you to expose only a single direction of connections exposed by foreign key constraints

Chandler Gonzales 4 Mar 13, 2022
TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite databases.

TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, MariaDB, PostgreSQL and SQLite datab

MikroORM 5.4k Dec 31, 2022
Welcome to the LEGO Games Repository, where you can enjoy anytime, anywhere. This is the 2021 KNU Advanced Web Programming team project.

Welcome to LEGO git repository! Here are some useful information about LEGO service. 0. Docker image Link : https://hub.docker.com/r/leibniz21c/legoga

Heesung Yang 16 Jul 21, 2022