JSPM

  • Created
  • Published
  • Downloads 70
  • Score
    100M100P100Q79323F
  • License MIT

Manage documents in Mongo defining features

Package Exports

  • monguments

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (monguments) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

monguments

Manage your mongo documents with features. High traceability.

Table of Contents

Installation

npm install monguments

Usage

let monguments = require('monguments');
var myMonguments;

monguments(conf, collections,
    connector => {
        myMonguments = connector;
    });

myMonguments.process(request, "","nameCollection", callback);

request

var request = {
    user:"",
    ips: [],
    data: {}
}

The standard request for all operations contains:

  • user: it is the identification of user in your system, it is used for traceability.
  • ips: this param do reference to the ip for identification of origin of request.
  • data: is a object with the information to process, this change with each type of operations.

Easy operations

process

permissions

It is a string wiht two characters, the first character is for read permission, the second character is for write permision. If character is lowercase the permission is for only documents of owner user, if character is uppercase the permission if for all documents in the collections.

Read permisions: 'r' or 'R'

Write permisions: 'w' of 'W' for write and 'C' or 'c' for only create the document.

callback

var response = {
    data:"",
    error: "",
    msg: ""
}

read & readList

write

add

set

close

Raw operations

read

write

add

set

close

Configuration

let conf = {
    server: 'localhost',
    database: 'test',
    user: 'user',
    password: 'pwd',
    replicaSet: 'replicaSet',
}

Features

let collections = {
    myCollection: {
        owner: '_id',
        versionable: false,
        versionTime: 0,
        closable: false,
        closeTime: 0,
        exclusive: false,
        id: '_id',
        idAuto: true,
        add: [],
        set: [],
        required: []
    }
}

Owner

Versionable

Closable

Exclusive

Id

Add

Set

Required