Noomman

Nodejs Object-Oriented MongoDB Manager

Introduction

Noomman provides a comprehensive object management system for application development. Unlike other MongoDB client libraries, Noomman is designed to follow strict object-oriented principals. Noomman allows multiple layers of inheritance, inheritance from multiple parents, and abstract class models. This inheritance applies to every aspect of the schema. All code for a given class model can be encapsulated in a single .js file, including the schema, static and non-static methods, and methods for instance-level privileges and validation.

Developers create class models using a schema object to define valid data structure, inheritance, instance-level privilege, and auditablility. Noomman manages a MongoDB database for holding the data, and abstracts away updating operations, so developers only have to make their desired changes to the data and then call Noomman to save it. Noomman provides a consistent API for CRUD operations, enforcing data consistency, validation, and security. Noomman also abstracts away common querying operations so that developers can traverse and filter the model in an object-oriented manner.

Database Schema

Developers provide a schema for each class model in in the form of a Javascript object. The schema describes the attributes and relationships for a class, inheritance properties, instance-level privileges, auditablility, validations, and static and non-static methods. Noomman implements classical inheritance in its object model, allowing multi-level, and multi-parent inheritance, and providing easy querying with respect to inheritance. All properties of a schema, including methods, validation, and privilege functions, are inherited from a super class model to a sub class model.

Data Consistency

For each relationship on a class, the developer will also describe the cardinality, directionality, and ownership properties of the relationship in their database schema. With this information Noomman is able to ensure data consistency. Everytime you save an update to one side of a two-way relationship on an instance, Noomman will update the relationships on the instances related through that relationship, ensuring that both directions of the relationship stay in sync. If you ask Noomman to delete an instance, it will be removed from any two-way relationships that it is a part of. If the instance has an owns relationship to another instance, Noomman will perform a cascading delete to ensure there are no orphaned instances.

Instance-Level Privileges

Noomman provides a dynamic framework for controlling in what circumstances any object may be created, read, updated, or deleted. Instance-level privileges can be programmatically defined by providing an asynchronus function in the class model schema for a class. These functions should return true if an opertion is allowed, and return false otherwise. Each operation can have its own function for determining if that particular operation is allowed, or you can use the same function for multiple operations.

Update History

A Noomman class model has an option called auditable. With this option enabled, Noomman will keep a changelog for every update of every instance of the class model. Objects can be completely reversed to any point in time using this changelog. If you choose not to delete the change log for an instance when that instance is deleted, you can completely recover a deleted instance using the change log information.

Implementation

Noomman is a nodejs package. It uses the native MongoDB javascript client to communicate with a mongo database, or a database that can be used with the native mongo client.