Currently, the database only supports desktop environments. It can be extended to other platforms via custom adapters (see below in docs).

Overview

There are two main entities for modelling storage - Block and Collection. A Block is like a document in MongoDB, while a Collection is just a collection of Blocks. Both blocks and collections are identified by unique filesystem-like "paths".

Though collections have no purpose other than to organise blocks, blocks do have a few features of note -

Although blocks and collections are stored as files and directories in desktop environments, accessing them directly will break things. Always access them via the maya-db library.

API

A lot of the examples below will be based on the paths of blocks and collections, we'll be using this hierarchy as an example everywhere -

db/
├─ tokens/
│  ├─ oauth/
│  │  ├─ v2/
│  │  │  ├─ spotify.block (encrypted)
│  │  │  ├─ google.block (encrypted)
│  │  ├─ v1/
│  │  │  ├─ hubspot.block (encrypted)
├─ global/
│  ├─ profiles/
│  │  ├─ module1.block (un-encrypted)
│  │  ├─ module2.block (un-encrypted)

General functions

Collection

A Collection object represents a database collection (as described above). It exposes the following functions (all of which are synchronous).