imlucas/mongodb-datasets — pull request #40 by TZ2016 (2014-07-31 16:16:57+00:00)
Title: new array API

@imlucas
* Added class ArrayField dedicated to handling arrays. (this helps simplify Document and Field's structure: there is no duplicate code on checking whether the input is an array and if yes generating multiple times, etc..)
* The new array API may need further polishing.

API:
* All configured arrays must conform to the format:
+ `[ "{{_$config}}", {/*options*/}, , /*optionally*/ ]`
* Arrays whose first element is not `{{_$config}}` are treated as ordinary arrays
+ multiple elements are ok, `[ '{{chance.name()}}', '{{chance.age()}}' ]`
+ different types are ok `[ true, 3, { doc: 'doc' }, [ "array" ]]`
* Supported options:
+ `size` - can be a number or an array of two numbers ([min, max]). the number of times the contents will be repeated