1.0.0 • Published 7 years ago
mongowb v1.0.0
MongoWB™
An expression evaluator that wants to be like MongoDB.
- Object that has a MongoWB™ operations as a property
- The parameters of the operation are in the value.
$concat
- Argument: array
- Arrays, MongoWB™, or elements
- Returns an array
$foreach
- Argument: object- object.$collection: Array, MongoWB™, FormulaValues™
- object.$template: MongoWB™, FormulaValues™
 
Example:
{
	"_id": "A",
  "name": "Recojo de almacén",
  "input": [
    {
      "name": "fecha",
      "type": "datetime",
      "required": true
    },
    {
      "name": "posts",
      "type": "post",
      "multiplicity": "1..*"
    }
  ],
  "context_processing": [ // name to be defined
    {
      "type": "sushi",
      "sources": {
        "collection": "={{posts}}",
	      "recipe": [
	      	// ...
	      ]
      },
      "destination": "pedidos",
    }
  ],
  "template": {
    "text": "Recoger material de almacén",
    "todos": {
    	"$concat": [
    		{
    			"$foreach": {
    				"$collection": "={{pedidos}}",
    				"$template": {
    					"text": "Recoger {{$item.cantidad}} {{$item.producto}}"
    				}
    			}
    		},
    		{
    			"text": "Firmar pedidos"
    		}
    	]
    }
  }
}Test
npm test
1.0.0
7 years ago