Fast and advanced, document based NoSQL database that able to work as it is installed.
- NoSQL database
- Can be run as it is installed
- Customizable settings for collections
- Quick data reading and writing
- Automatically or manual backup
- No need to use schema
- Easy to find data
npm install peak.db --save
const PeakDB = require("peak.db");
var accounts = new PeakDB.Collection({
"name": "ACCOUNTS", // Name of collection (required)
"id_length": 32, // This determines the length of unique identities given to documents. (no required, default: 32)
"delete_backups_before_this_day": 3, // This determines how many days of backups will be deleted. (no required, default: 3)
"auto_backup": true, // If active this, this collection will receive automatic backups. (no required, default: false)
"indicate_created_at": true, // If active this, will be automatically specified date when documents are created. (no required, default: false)
"indicate_created_timestamp": true, // If active this, will be automatically specified timestamp when documents are created. (no required, default: false)
"indicate_updated_at": true, // If active this, will be automatically specified date when documents are updated. (no required, default: false)
"indicate_updated_timestamp": true // If active this, will be automatically specified timestamp when documents are updated. (no required, default: false)
});
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"
}
*/
accounts.find(document => document.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"
}
*/
accounts.filter(document => document.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"
}
]
*/
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"
}
*/
let document = accounts.find(document => document.email === "[email protected]");
accounts.delete(document._id);
// true
accounts.backup();
// true