1.0.6 • Published 2 years ago
sqlite-document-db v1.0.6
UNDER CONSTRUCTION
SQLite Document DB
Use SQLite as a JSON Document Database.
API based on MongoDB's JavaScript API.
Getting started
- Install using NPM:
npm i --save sqlite-document-db
- Start using it:
import Db from 'sqlite-document-db'
const db = await Db.fromUrl(':memory:') // Can also be a path to your DB file
// Insert some users into a collection
await db.collection('users').insertOne({ username: 'test_user', email: 'test@example.com' })
await db.collection('users').insertMany([
{ username: 'test_user2', email: 'test2@example.com' },
{ username: 'test_user3', email: 'test3@example.com' },
])
const user = await db.collection('users').findOne({ email: 'test3@example.com' })
console.log(user)
Console output of the above:
{
_id: '626964400e547e782d04d7f1',
username: 'test_user2',
email: 'test2@example.com'
}
Examples
Missing Features
Thanks
Thanks to https://github.com/thomas4019/mongo-query-to-postgres-jsonb for being a huge inspiration for this project.