Welcome to the JexiDB documentation! This directory contains comprehensive guides and references for using JexiDB effectively.
Complete API documentation covering all methods, options, and features:
- Database constructor and configuration
- Core methods (insert, update, delete, find)
- Advanced features (term mapping, bulk operations)
- Query operators and complex queries
- Performance optimization tips
💡 Examples
Practical examples and real-world use cases:
- Basic usage patterns
- User management systems
- Product catalogs
- Blog systems
- Analytics dashboards
- Performance optimization techniques
- Error handling strategies
If you're new to JexiDB, start with these resources:
- Installation: See the main README.md for installation instructions
- Basic Usage: Check out the Basic Usage section in Examples
- API Reference: Browse the API Reference for detailed method documentation
- Advanced Features: Explore Term Mapping and Bulk Operations
- Term Mapping: Reduce database size by up to 77% for repetitive data
- Bulk Operations: High-performance
iterate()method for large datasets - Advanced Querying: Support for complex queries with logical operators
- Indexed Query Modes: Strict and permissive query modes for performance control
- Streaming operations for memory efficiency
- Automatic term cleanup
- Optimized indexing strategies
- Batch processing capabilities
Define which fields to keep in memory for fast queries:
const db = new Database('app.jdb', {
fields: { // REQUIRED - Define schema
id: 'number',
name: 'string',
email: 'string'
},
indexes: { // OPTIONAL - Only fields you query frequently
email: 'string' // ✅ Login queries
}
})Optimize storage for repetitive string data:
const db = new Database('app.jdb', {
fields: { // REQUIRED - Define schema
id: 'number',
name: 'string',
tags: 'array:string',
categories: 'array:string'
}
// termMapping is now auto-enabled for array:string fields
})Process large datasets efficiently:
for await (const record of db.iterate({ status: 'pending' })) {
record.status = 'processed'
record.updatedAt = Date.now()
}const db = new Database('my-app.jdb', options)
await db.init() // Initialize
// ... use database ...
await db.save() // Save changes
await db.destroy() // Clean uptry {
await db.init()
await db.insert(data)
await db.save()
} catch (error) {
console.error('Database error:', error)
} finally {
await db.destroy()
}// Simple queries
const users = await db.find({ status: 'active' })
// Complex queries
const results = await db.find({
age: { '>': 18, '<': 65 },
$or: [
{ role: 'admin' },
{ role: 'moderator' }
]
})
// Case-insensitive search
const results = await db.find(
{ name: 'john doe' },
{ caseInsensitive: true }
)const db = new Database('database.jdb', {
create: true, // Create file if doesn't exist
clear: false, // Clear existing data
fields: { // REQUIRED - Define schema
id: 'number',
name: 'string'
},
indexes: { // OPTIONAL - Only fields you query frequently
name: 'string' // ✅ Search by name
},
indexedQueryMode: 'permissive' // Query mode
})const db = new Database('database.jdb', {
fields: { // REQUIRED - Define schema
id: 'number',
name: 'string',
tags: 'array:string'
},
indexes: { // OPTIONAL - Only fields you query frequently
name: 'string', // ✅ Search by name
tags: 'array:string' // ✅ Search by tags
}
// termMapping is now auto-enabled for array:string fields
})- Use indexed fields in your queries for best performance
- Enable term mapping for datasets with repetitive strings
- Use
iterate()for bulk operations on large datasets - Specify fewer indexes to reduce memory usage
- Use
save()strategically to persist changes
- Issues: Report bugs and request features on GitHub Issues
- Documentation: Browse this documentation for detailed guides
- Examples: Check out the Examples for practical use cases
- API Reference: Consult the API Reference for method details
Found an issue with the documentation? Want to add an example?
- Fork the repository
- Make your changes
- Submit a pull request
We welcome contributions to improve the documentation!
Happy coding with JexiDB! 🚀