Doubledb is a powerful on-disk database that simplifies data management by indexing everything for fast querying. With straightforward methods for inserting, updating, and retrieving data, it seamlessly integrates with your projects, ensuring you spend less time on data handling and more on building your application.
doubledb is a powerful on-disk database designed for efficient and fast indexing, facilitating quick data retrieval. With a seamless API, doubledb allows you to perform complex queries and manage your data effortlessly.
Key Features
- Fast Indexing: Get the speed and efficiency you need for real-time data access.
- Comprehensive Querying: Utilize a variety of methods to insert, find, filter, and query your records with simplicity.
Usage Example
To get started, you can create an instance of doubledb and begin inserting data. Here’s a quick example of how to use doubledb:
import createDoubledb from 'doubledb';
const doubledb = await createDoubledb('./data');
// Inserting a record
const record = await doubledb.insert({
id: undefined, // Automatically generates a unique identifier
firstName: 'Joe',
lastName: 'Bloggs',
stats: { wins: 10, loses: 5 },
skills: ['cooking', 'running']
});
// Retrieving a record by its id
const retrievedRecord = await doubledb.get(record.id);
// Finding a record by field value
const foundRecord = await doubledb.find('firstName', 'Joe');
// Filtering records
const filteredRecords = await doubledb.filter('skills', v => v.includes('cooking'));
Advanced Querying
With doubledb, you have the ability to utilize complex queries for advanced data retrieval. Here’s how to use a query object:
const records = await doubledb.query({
age: { $gte: 18, $lt: 30 },
status: { $in: ['active', 'pending'] },
$or: [
{ role: { $eq: 'admin' } },
{ role: { $eq: 'user' } }
]
});
Supported Operators
When using the query method, you can enhance queries with several operators, including:
- $eq: Equal to a value.
- $ne: Not equal to a value.
- $gt / $gte: Greater than / greater than or equal to.
- $lt / $lte: Less than / less than or equal to.
- $in / $nin: Value is in / not in the provided array.
Boost your development with doubledb and experience the kind of performance and flexibility that makes data management simple and effective.
No comments yet.
Sign in to be the first to comment.