
Security News
AI Slop Is Polluting Bug Bounty Platforms with Fake Vulnerability Reports
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.
LiaMongo is a simplified MongoDB key-value store designed to make MongoDB operations easier for casual developers. It provides a straightforward interface for storing and retrieving key-value pairs in MongoDB collections.
Many developers find MongoDB's document-oriented approach flexible but sometimes overwhelming, especially for simple key-value storage scenarios. LiaMongo aims to simplify this process by abstracting away much of the complexity of interacting with MongoDB.
LiaMongo is targeted towards developers who need a simple and intuitive way to store key-value data in MongoDB without dealing with the intricacies of the MongoDB driver or schema design.
The primary advantage of LiaMongo is its ease of use. By providing a straightforward API for common MongoDB operations, developers can quickly integrate LiaMongo into their projects without needing extensive knowledge of MongoDB internals.
While the key-value schema provides simplicity and flexibility, it may not be suitable for all use cases, especially those requiring complex querying or relationships between data. Additionally, the lack of schema validation for the value field may lead to inconsistencies in data storage.
npm install lia-mongo
const LiaMongo = require('lia-mongo');
Creates a new instance of LiaMongo.
options
: An object containing configuration options.
uri
: MongoDB connection URI.collection
: Name of the MongoDB collection to use.isOwnHost
: (Optional) Boolean indicating whether the MongoDB instance is hosted on the same machine. Default is false
.ignoreError
: (Optional) Boolean indicating whether to ignore connection errors. Default is false
.allowClear
: (Optional) Boolean indicating whether clearing the collection is allowed. Default is false
.createConnection
: (Optional) Boolean indicating whether to create a new connection. Default is false
.A new instance of LiaMongo.
const liaMongo = new LiaMongo({
uri: "mongodb://localhost:27017/mydb",
collection: "myCollection",
isOwnHost: true,
});
Connects to the MongoDB database.
ignoreReconnect
: (Optional) Boolean to ignore reconnection errors if already connected.Promise.
await liaMongo.start();
Retrieves the value associated with the given key.
key
: The key to retrieve the value for.Promise | null: The value associated with the key, or null if not found.
const value = await liaMongo.get("myKey");
Stores a key-value pair in the MongoDB collection.
key
: The key to store.value
: The value to store.Promise.
await liaMongo.put("myKey", "myValue");
Removes the key-value pair with the given key from the MongoDB collection.
key
: The key to remove.Promise.
await liaMongo.remove("myKey");
Checks if the given key exists in the MongoDB collection.
key
: The key to check.Promise: True if the key exists, false otherwise.
const exists = await liaMongo.containsKey("myKey");
Gets the number of key-value pairs in the MongoDB collection.
Promise: The number of key-value pairs.
const size = await liaMongo.size();
Clears all key-value pairs from the MongoDB collection.
Promise.
await liaMongo.clear();
Retrieves an array of all keys in the MongoDB collection.
Promise<string[]>: An array of keys.
const keys = await liaMongo.keys();
Retrieves an array of all values in the MongoDB collection.
Promise<any[]>: An array of values.
const values = await liaMongo.values();
Retrieves an array of all key-value pairs in the MongoDB collection.
Promise<{ key: string, value: any }[]>: An array of key-value pairs.
const entries = await liaMongo.entries();
Loads all key-value pairs from the MongoDB collection into an object.
Promise: An object containing all key-value pairs.
const data = await liaMongo.load();
Pre-processes the given data.
data
: The data to pre-process.Promise: The pre-processed data.
const preProcessedData = await liaMongo.preProc(data);
Converts all key-value pairs in the MongoDB collection into an object.
Promise: An object containing all key-value pairs.
const objectData = await liaMongo.toObject();
Converts all key-value pairs in the MongoDB collection into a JSON object.
Promise: A JSON object containing all key-value pairs.
const jsonData = await liaMongo.toJSON();
Returns an iterator for the key-value pairs in the MongoDB collection.
AsyncIterator<{ key: string, value: any }>.
for await (const entry of liaMongo) {
console.log(entry);
}
Returns an iterator for the keys in the MongoDB collection.
AsyncIterator.
for await (const key of liaMongo.iKeys()) {
console.log(key);
}
Returns an iterator for the values in the MongoDB collection.
AsyncIterator.
for await (const value of liaMongo.iValues()) {
console.log(value);
}
Inserts or updates multiple key-value pairs in the MongoDB collection in a single operation.
pairs
: An object where keys are the keys to insert/update and values are the corresponding values.Promise.
await liaMongo.bulkPut({
key1: "value1",
key2: "value2",
});
Retrieves values for multiple keys in a single operation. This method accepts individual keys or an array of keys.
...keys
: One or more keys or an array of keys to retrieve values for.Promise<any[]>: An array of values corresponding to the given keys. Returns an empty array if no values are found or if an error occurs and ignoreError
is set to true
.
const values = await liaMongo.bulkGet("key1", "key2");
Or
const values = await liaMongo.bulkGet(["key1", "key2"]);
The schema used for storing key-value pairs in MongoDB.
LiaMongo.schema;
LiaMongo npm package created by Liane Cagara.
FAQs
A simplified MongoDB key-value store for casual developers.
The npm package lia-mongo receives a total of 247 weekly downloads. As such, lia-mongo popularity was classified as not popular.
We found that lia-mongo 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
AI-generated slop reports are making bug bounty triage harder, wasting maintainer time, and straining trust in vulnerability disclosure programs.
Research
Security News
The Socket Research team investigates a malicious Python package disguised as a Discord error logger that executes remote commands and exfiltrates data via a covert C2 channel.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.