Process for adding the same dummy content frequently after db wipe?


#1

Im prototyping my app so things are changing frequently. I often have to delete a collection or even the entire database. This means I have to manually add my dummy content back each time. How can I automate some of this?

My current process is to have an insert function in Meteor.startup. After wiping the database I paste the code in, let it run, and then delete it again. This is working locally but will be harder to do on my deployed site.

Meteor.startup(() => {
Events.insert(
name: ‘Test event’,
attachedTo: ‘w3i6m8k8eytrLp57W’,
desc: ‘This is a test event’,
date: ‘new Date()’,
location: ‘somewhere’,
});
});

To avoid errors I would rather call my existing Meteor methods than insert directly into Mongo. Is this possible?


#2

Running your app in full-test mode creates a new Mongo db on every startup, which you can then seed with the same dummy records like you do now.

A little more info is here.


#3

That doesnt solve all my problems but looks really handy for testing, thanks.