Data Model

This section covers defining Business Objects as well as using the server-side persistence layer for accessing and manipulating those objects.

Business Object Definition

The data layer of a Noonian application is defined by creating a collection of BusinessObjectDef objects.

Persistence API

The API is modelled after the Mongo shell, wherein each collection in the database corresponds to a property on the db object, and that property contains the full CRUD interface for working with that collection:

//Mongo shell
db.SomeCollection.find(...)

The db API in Noonian functions in a similar fashion. Each Business Object Definition (BusinessObjectDef) in the system corresponds to a property on the db object, and that property contains the full CRUD interface for working with those Business Objects:

//Server-side Noonian code
db.SomeBusinessObject.find(...).then(resultList=>{...})

These properties on the db object are called the Business Object Models, and are in fact augmented instances of Model from the mongoose library. This documentation will cover the most important functions, but the full API can be referenced on the mongoose project website (the current version of Noonian utilizes mongoose v5.9).

Differences from Mongo and Mongoose

An understanding of the MongoDB shell operations and the mongoose API translates to an almost complete understanding of the Noonian persistence API. This section describes where Noonian differs from one or the other.

Noonian and Mongoose are Promise-Based

The objects returned when running operations in the mongo shell generally provide synchronous access to the data. For example:

> u = db.User.findOne({name:'admin'});
> print(u.name);
admin
>

Noonian/Mongoose run asynchronously utilizing promises:

db.User.findOne({name:admin}).then(u=>{
   console.log(u.name);
});

Noonian and Mongoose are Schema-Based

Construct objects instead of using “insert”.

Metadata

Inheritance

Other Internals

  • Data Triggers

  • Field pre/post processing

  • ID Generation

Creation/Insertion

Query/Lookup

Deletion

Aggregation Pipeline