Project details
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.
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'));
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' } }
]
});
When using the query method, you can enhance queries with several operators, including:
Boost your development with doubledb and experience the kind of performance and flexibility that makes data management simple and effective.
Comments
0Start the conversation
Share the first comment.