
Research
/Security News
Toptal’s GitHub Organization Hijacked: 10 Malicious Packages Published
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
jsondb-client
Advanced tools
Here’s the updated README with the correct database name jsondb-yu03
:
jsondb-client
is a server-based JSON database package designed for easy and secure CRUD operations using API requests. The database can be hosted anywhere securely with limits and custom authentication. The UI for the client is under development using Electron.js.
jsondb-client
provides a simple and efficient way to interact with JSON databases similar to traditional MongoDB, but using the jsondb-yu03
server. This package allows you to manage your databases securely and with custom authentication, enabling you to host and manage your data effectively.
Note: The server-side operations are private and protected to prevent theft or unauthorized access. Ensure that your server configurations and credentials are kept secure to prevent any potential misuse.
Install via npm:
npm install jsondb-client
const dbClient = require("jsondb-client");
const db = dbClient.setConnection({
server: 'https://jsondb-yu03.onrender.com',
username: 'testuser.com',
password: '370149ecaf812899',
database: 'jsondb-yu03'
});
const collection = db.Collection('fun');
create(data)
Creates a new document in the specified collection.
const result = await collection.create({ name: "John Doe", age: 30 });
console.log(result);
find(query)
Finds all documents matching the query.
const results = await collection.find({ age: { $gt: 20 } });
console.log(results);
findOne(query)
Finds a single document matching the query.
const result = await collection.findOne({ name: "John Doe" });
console.log(result);
findById(id)
Finds a document by its unique ID.
const result = await collection.findById("12345");
console.log(result);
save(data)
Creates or updates a document based on the provided data.
const result = await collection.save({ _id: "12345", name: "Jane Doe" });
console.log(result);
update(id, data)
Updates a document by its ID.
const result = await collection.update("12345", { age: 31 });
console.log(result);
updateOne(query, data)
Updates a single document matching the query.
const result = await collection.updateOne({ name: "John Doe" }, { age: 31 });
console.log(result);
updateMany(query, data)
Updates multiple documents matching the query.
const result = await collection.updateMany({ age: { $lt: 30 } }, { active: false });
console.log(result);
findByIdAndUpdate(id, data)
Finds a document by ID and updates it.
const result = await collection.findByIdAndUpdate("12345", { age: 31 });
console.log(result);
findOneAndUpdate(query, data)
Finds a single document matching the query and updates it.
const result = await collection.findOneAndUpdate({ name: "John Doe" }, { age: 31 });
console.log(result);
deleteOne(query)
Deletes a single document matching the query.
const result = await collection.deleteOne({ name: "John Doe" });
console.log(result);
deleteMany(query)
Deletes multiple documents matching the query.
const result = await collection.deleteMany({ age: { $lt: 30 } });
console.log(result);
findByIdAndDelete(id)
Finds a document by ID and deletes it.
const result = await collection.findByIdAndDelete("12345");
console.log(result);
findOneAndDelete(query)
Finds a single document matching the query and deletes it.
const result = await collection.findOneAndDelete({ name: "John Doe" });
console.log(result);
countDocuments(query)
Counts the number of documents matching the query.
const count = await collection.countDocuments({ active: true });
console.log(count);
distinct(field, query)
Finds distinct values for a specified field.
const values = await collection.distinct("age", { active: true });
console.log(values);
aggregate(pipeline)
Performs an aggregation operation.
const results = await collection.aggregate([{ $match: { active: true } }]);
console.log(results);
populate(path, query)
Populates a field by joining related data.
const result = await collection.populate("user", { active: true });
console.log(result);
exec(command, params)
Executes a custom command with parameters.
const result = await collection.exec("customCommand", { param1: "value1" });
console.log(result);
To delete a user, make a DELETE
request to the /delete-user
endpoint.
Request:
DELETE /delete-user
Content-Type: application/json
Body:
{
"username": "user_to_delete"
}
Response:
{
"message": "User deleted successfully"
}
Error Response:
{
"message": "User not found"
}
To delete a collection, make a DELETE
request to the /:dbName/:collectionName/delete-collection
endpoint.
Request:
DELETE /:dbName/:collectionName/delete-collection
URL Parameters:
dbName
: The name of the database.collectionName
: The name of the collection to delete.Response:
{
"message": "Collection 'collectionName' deleted successfully"
}
Error Response:
{
"message": "Collection not found"
}
To delete a database, make a DELETE
request to the /delete-db/:dbName
endpoint.
Request:
DELETE /delete-db/:dbName
URL Parameters:
dbName
: The name of the database to delete.Response:
{
"message": "Database 'dbName' deleted successfully"
}
Error Response:
{
"message": "Database not found"
}
To create new credentials, use the following curl
command:
curl --location 'https://jsondb-yu03.onrender.com/register' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic bWFub2pnb3dkYWJyODkuY29tOmZmNzkwNTU1Zjk3YTZkNzc=' \
--data '{
"email": "testuser.com"
}'
Response:
{
"message": "User registered successfully",
"username": "testuser.com",
"password": "370149ecaf812899"
}
To create a database, use the following curl
command:
curl --location 'https://jsondb-yu03.onrender.com/add-database' \
--header 'Authorization: Basic dGVzdHVzZXIuY29tOjM3MDE0OWVjYWY4MTI4OTk=' \
--header 'Content-Type: application/json' \
--data '{
"database":"jsondb-yu03"
}'
Response:
{
"message": "Database added successfully",
"databases": [
"jsondb-yu03"
]
}
To create a collection, use the following curl
command:
curl --location --request POST 'https://jsondb-yu03.onrender.com/jsondb-yu03/testcollection' \
--header 'Authorization: Basic dGVzdHVzZXIuY29tOjM3MDE0OWVjYWY4MTI4OTk=' \
--header 'Content-Type: application/json'
Response:
{
"message": "Collection created successfully",
"collection": "testcollection"
}
MIT : manojgowdabr89@gmail.com
Feel free to make any additional adjustments or add more details as needed!
FAQs
const db = require('jsondb');
We found that jsondb-client demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
/Security News
Threat actors hijacked Toptal’s GitHub org, publishing npm packages with malicious payloads that steal tokens and attempt to wipe victim systems.
Research
/Security News
Socket researchers investigate 4 malicious npm and PyPI packages with 56,000+ downloads that install surveillance malware.
Security News
The ongoing npm phishing campaign escalates as attackers hijack the popular 'is' package, embedding malware in multiple versions.