Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
verse.db isn't just a database, it's your universal data bridge. Designed for unmatched flexibility, security, and performance, verse.db empowers you to manage your data with ease.
verse.db isn't just a database, it's your universal data bridge. Designed for unmatched flexibility, security, and performance, verse.db empowers you to manage your data with ease.
The verse.db package is a powerful utility designed to simplify the management of data files within a designated folder. It offers methods for adding, editing, deleting, and retrieving data from JSON, YAML, SQL & more files. This wiki provides detailed examples and usage scenarios to help you effectively implement the verse.db package in your projects.
To begin using the verse.db package, you'll need to install it via npm. Open your terminal and run the following command:
npm install verse.db
yarn add verse.db
to get started setup the database connection uding .connect method
const versedb = require("verse.db");
// or
import versedb from "verse.db";
const adapterOptions = {
adapter: "json" | "yaml" | "sql", // the type of the adapter json, yaml or sql
dataPath: "./Data", // the path of the data folder
devLogs: { enable: true, path: "./Logs" }, // the path to the logs folder
encryption: { enable: false, secret: "" }, // Under Development: Encryption option
backup: { enable: false, path: "", retention: 0 }, // Under Development: Backing up
};
const db = new versedb.connect(adapterOptions); // use the connect method to connect a database
Note*: that you can make a multiple databases in the same time with/without the same extention
You can load any data file using .load method
const dataname = "data"; // the name of the datafile without the extention
const result = await db.load(dataname);
console.log(result);
To add data, use the .add method, for example:
// Arrange
const data = [
{ _id: "1234", name: "John" },
{ _id: "5678", name: "Jane" },
];
const dataname = "dataFileName";
// Act
const result = await db.add(dataname, data);
result:
{
"acknowledged": true,
"message": "Data added successfully.",
"results": [
{ "_id": "1234", "name": "John" },
{ "_id": "5678", "name": "Jane" }
]
}
Find the data you want with the query you want using .find method:
// Arrange
const data = [
{ _id: "1234", name: "John" },
{ _id: "5678", name: "Jane" },
];
const query = { name: "John" };
const dataname = "dataFileName";
// Act
const result = await db.find(dataname, query);
// Assert
expect(result).toEqual({
acknowledged: true,
message: "Found data matching your query.",
results: { _id: "1234", name: "John" },
});
Remove the data you want with the query you want using .remove method:
// Arrange
const data = [
{ _id: "1234", name: "John" },
{ _id: "5678", name: "Jane" },
];
const query = { _id: "1234" };
const dataname = "remove";
// Act
const result = await db.remove(dataname, query);
// Assert
expect(result).toEqual({
acknowledged: true,
message: "1 document(s) removed successfully.",
results: null,
});
Update the data you want with the query you want using .update method:
// Arrange
const data = [
{ _id: "1234", name: "John" },
{ _id: "5678", name: "Jane" },
];
const updateQuery = { $set: { name: "Mike" } };
const dataname = "update";
// Act
const result = await db.update(dataname, { name: "John" }, updateQuery);
// Assert
expect(result).toEqual({
acknowledged: true,
message: "1 document(s) updated successfully.",
results: {
_id: "1234",
name: "Mike",
},
});
The verse.db package simplifies the management of JSON data files within a specified folder. With the provided examples and usage instructions, you'll be able to efficiently integrate the verse.db package into your projects to streamline data operations.
FAQs
verse.db isn't just a database, it's your universal data bridge. Designed for unmatched flexibility, security, and performance, verse.db empowers you to manage your data with ease.
The npm package verse.db receives a total of 149 weekly downloads. As such, verse.db popularity was classified as not popular.
We found that verse.db demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.