JSqldb – JavaScript Query Language Database – is a relational and graph database server that speaks JavaScript, and persists JavaScript objects.

JSqldb is a database server, in principle like other database servers (mongo db , MySql, etc), but with a new level of programmability and versatility.

First there was JavaScript in the browser, then JavaScript on the server. Now take “JavaScript everywhere” to the next level: introducing a database with JavaScript as the query language.

Features

  • Rapid development due to ability to persist data exactly as it is used, no joins or table relations required. No table boundary, no document boundary, entire database is one traversable JavaScript object graph.
  • Built for high performance – runs on v8 JavaScript engine and Rocksdb storage engine
  • Natively store, query and retrieve JSON data
  • Integration with node.js, ability to use persistent data as if variables, no ORM required.
  • Ideal environment for AI development, run complex code directly in database with full direct high performance access to all data, and self modifying graph structures.
Technical Introduction

Queries are written in JavaScript, and responses are received as JSON or JavaScript.

Example query:
Saving data to the database is as simple as variable assignment.

Work with persistent data as if it is normal in memory data – assign, modify and read persistent data as if javascript variables.

It does not store just JSON, it stores JavaScript objects, including executable functions, and references to other objects.

It can use these references and connections to model graph data, but it can also easily store tabular data using either object or array collections

Querying data

All queries target the database referred to by a database handle (db in this case). Getting the database handle depends on the client driver and will be covered later.
For simple queries, simple object access can be used, similar to accessing data from normal javascript objects.

The query language also defines various query functions that can be called on database objects, for example:

Inheritance

Like normal javascript object, JSqldb objects supports prototypal inheritance.

A benefit of this is that all fields that are at default values do not take up any storage space in the database.

Functions

Similarly functions are also supported, and could be seen as analogue to stored procedures in other database systems – but with the power and ease of javascript.

One final example

Next: JSqldb In Practice