fake meteor collections, with support for grapher links
-
Clone my forked version of grapher branch
patch-1
(see this PR for more info)git clone [email protected]:macsj200/grapher.git
-
Symlink the package into your app (or use
METEOR_PACKAGE_DIRS
environment variable) -
meteor add maxjohansen:collection-faker
-
Spin up your app, and pass it a settings file with
SeedDatabase
set totrue
-
Specify collections to seed with
seedCollection(options)
Options configuration
{
collection,
numItemsPerCollection = 20,
numArrayElements = 5,
preseed = [],
mutators = [],
}
collection
collection to seednumItemsPerCollection
how many items to seed, including preseeded itemsnumArrayElements
how many elements to populate array keys withpreseed
Definitions of objects to seed the collection with first. Only keys that are not specified will be generated. I.E. if you specify aname
attribute,item.name === name
, and all other fields will be generated onitem
.mutators
list of actions to perform after document insertion is complete. SpecifymutateSelector
mongo selection query object, andmutate(item)
to specify logic.
Add SeedDatabase
to your settings.json file
{
"SeedDatabase" : true
}
Optionally, you can elect to add an extra settings parameter, clearDbBeforeSeed
, which will drop the database upon every app reload (recommended only for development of this package).
{
"SeedDatabase" : true,
"clearDbBeforeSeed": true
}
In server code
import {seedCollection} from "meteor/maxjohansen:collection-faker";
seedCollection({
collection:Meteor.users,
numItemsPerCollection:15,
});