DianaDB Desktop
A desktop app for working directly with a DianaDB server: manage databases, collections and schemas, see how the collections of a database relate, create materialized views, run queries against real data, watch the server's metrics, and download the models of a database as TypeScript code.
See Install and Run DianaDb Server if you're setting up a server to connect the GUI to.
Linux
Windows
Connections
The application connects with @diana-db/odm, the client your own code uses, so a user needs the same access rights here as anywhere else.
- A connection is entered as a string,
diana-db://user:password@host:port(ordiana-dbs://for TLS), or as a form: host, port, user, password, pool size, connect and reconnect timeouts. - For a server with TLS the form takes the files of the client certificate, its key and the CA, and whether the server's certificate is verified.
- Connections are saved on your computer, encrypted with the key store of the operating system. They can be edited, removed and put in order by dragging.
- One connection is open at a time. The header shows the user, the server and the server's version.
Databases and collections
- Create and remove databases; each shows how many collections and views it has.
- Create and remove collections. A collection shows its number of fields and documents, and whether its schema is locked. Clicking one makes it the active collection of the schema, views and query tabs.
- The reload button fetches the collections and views from the server again.
Collection schema
The schema editor is used to create a collection and to change one. See Schema and Types for what the options mean.
- Add, change and remove fields, each with its type.
- Options per field: required, unique, mutable, lowercase or uppercase, a default value, the precision of a number, the collection a reference points to, the items of an array, the dimensions of a vector.
- Lock Schema and Unlock Schema: a locked schema cannot be changed by anyone until it is unlocked.
- Reset brings back the schema as the server has it.
Database design
The ⌗ button of a database opens a diagram of it.
- A card for every collection with its fields and types, and a card for every materialized view.
- A line for every reference between two collections, and from a view to its collection.
- Cards can be moved. Their places are remembered per connection and database; one button lays every card out again.
- The diagram can be downloaded as a PNG.
Download code
Since 2.3.0 the </> button of a database saves its models as one TypeScript file, diana-db.data.code.ts, ready to use with @diana-db/odm. The file has:
config: the settings of the connection you are using. The password is not exported: it is replaced by'******'. Certificates are read from the files the connection names.dianaDb: a client created with thatconfig.- For every collection: an interface of its documents (
User), a model (userModel) with the schema as the server has it, and an enum of its views (UserViews) to pass tofindByViewandcountByView. models: every model by the name of its collection.connect(): connects and initializes every model, which creates a missing collection and brings the schema of the others in line with the file.
import { connect, userModel, UserViews } from './diana-db.data.code';
await connect();
const adults = await userModel.findByView(UserViews.adults, { age: { $gte: 21 } });
Defaults, getters and setters that exist only in your application's code are not part of the server's schema, so they are not in the file: add them to the models after downloading. The file has the same name for every database (DATABASE inside it says which one it is), so give it another name in the save dialog when you download more than one.
Materialized views
- The views of the active collection, each with its transform queries.
- Create a view from a name and a
TransformQuery[], change the queries of an existing view, or remove it. See Materialized Views.
Query tool
Queries are written as JavaScript literals, the way they are written in code: [{ age: { $gte: 21 } }].
| Tab | What it takes |
|---|---|
| Find | Filter query, transform query, sorting, skip and limit (up to 100 documents a page). Count counts the same query; a find also shows its count. |
| Insert | A document |
| Find By View | A view of the collection, a query, sorting, skip and limit; Count for the same query |
| Update | Filter query and update query |
| Remove | Filter query |
| Min, Max, Distinct | A field of the collection |
- What you typed is remembered per collection and tab; Cancel clears the current tab.
- A list of documents can be exported as JSON or CSV, a single result as JSON.
- The time the last request took is shown above the result.
Live updates
The application subscribes to the databases it shows. Changes made by other clients (documents, collections, views and schemas) appear without a reload.
Server metrics
- Memory, CPU, GC pressure, event-loop utilization and event-loop delay of the server, as graphs or as a table.
- A warning while the server's memory guard refuses requests because memory is almost exhausted.
- Whether the server is reachable: the header says when the connection is lost.
Updates
The application checks for a new version when it starts, downloads it and installs it.