Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Fast document oriented NodeJS database for node and browser. Allow adapters for in-memory, fs (JSON based or optimized), localStorage.
Fast in-memory database for node and browser that is portable and easy to use
The goal of TyrDB is to provide a fast, easy and instant to use database.
It aims at getting close to the performance and features you could find in your modern NoSQL DB solutions.
For that, a subset of the Mongo query syntax is being used, so the production switch from TyrDB dev env to MongoDB would be as fast as possible.
TyrDB is intended for bootstrapping project or small backend servers.
Due to the use of a modified B+Tree system, performance stays at service without the need to load everything in memory as you can encounter with many Node DB out-there.
N.B : Fields are indexed by default. Specifically exclude field that might be too lengthy as otherwise might have heavy performance effect (see more on BTree to understand).
Uniques field are also available.
TyrDB relies on SBTree as it's main dependencies for data.
npm install tyrdb
mkdir myproject
cd myproject
npm init
npm install tyrdb
touch index.js
And there just use that snipets to start playing ! :
const TyrDB = require('tyrdb');
const {MemoryAdapter} = require('tyrdb/adapters')
const adapter = new MemoryAdapter();
const client = new TyrDB({adapter});
async function start(){
await client.connect();
console.log('In sync with the adapter/server');
const db = await client.db('myproject');
const doc = {
name: 'Jean',
age: 33,
nestedObject:{isNested:true}
}
// Allow to pass along SBTree options
const opts = {};
const col = await db.collection('users', opts);
const insertedDoc = await col.insert(doc);
const search = await col.find({age:33}); //[{name:"Jean",age:33, nestedObject:{isNested:true}]
const [jean] = search;
jean.age = 34;
await col.replace(jean);
await client.close();
}
start();
Alternatively, you might prefer to wait for the DB to be ready (as it will autoconnect by default)
const TyrDB = require('tyrdb');
const {MemoryAdapter} = require('tyrdb/adapters')
const adapter = new MemoryAdapter();
const client = new TyrDB({adapter});
const dbName = 'myproject';
async function start(){
const db = await client.db(dbName);
await client.close();
}
db.on('ready',start);
MemoryAdapter
: Default adapter. Set Store inMemory. Limited by heap memory available (good enough).const {MemoryAdapter} = require('tyrdb/adapters')
const adapter = new MemoryAdapter();
const client = new TyrDB({adapter});
FsAdapter
: FileSystem adapter.
Default path will be .db
. Path and options should be passed in TyrDB constructor.Storage will be optimized therefore not planned to be easily browsable or openable (big files).
Each collection have a set of .dat
and .meta.json
file. Keep both are meta is needed to find the data in the data file :).
const {FsAdapter} = require('tyrdb/adapters')
const adapter = new MemoryAdapter();
const client = new TyrDB({path:'.db/mydbpath',adapter});
IndexedAdapter
: Persist in web browser indexed db storage : TODOLocalStorageAdapter
: Persist in web browser local storage : TODOAny move we might take will be in the direction of matching more carefully the mongo syntax. So you should be good on that.
No promises, I tend to love breaking things to move on.
The in-memory things. It's annoying, I need to be able to have as much as big documents as I would love without hitting that much the performance. So it uses a B+Tree modified architecture for storing. You can see the dependency here SBTree.
Right now, you are limited in the abilities of querying as we only support ($eq, $neq, $lt, $lte, $gt, $gte, $in, $nin), there is not yet all the fancyness from the MongoDB or anything yet (especially $regex).
It also might never come, dependings of if I need them myself or have extra time and demands for it, so mind opening an issue if it is your case in the SBTree repository :).
Also, if your document has it's own _id
value, then it should be a valid mongodb ObjectId value. Post an issue if that is colliding with your own data, we can change it.
TyrDB by default do not hold any data, only refs and indexes. Data are handled by adapters.
Therefore every element is caracterized by it's own metadata and data.
.export()
fetches the metadata elements.
.serialize()
the json representation of the elements.
TL;DR : Very few, especially by creating an adapter in TyrDB that would override uses of SBTree for a Mongoose or similar interface.
TODO : Feature
TODO STEP BY STEP.
It's a tribute to LokiDB existing with similar purpose (with limitation that weren't suiting my needs). Therefore TyrDB.
FAQs
Fast document oriented NodeJS database for node and browser. Allow adapters for in-memory, fs (JSON based or optimized), localStorage.
We found that tyrdb demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.