123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- /**
- * @file
- *
- *
- * User: marand
- * Date: 30/08/15
- * Time: 11:33
- */
- if (Posts.find().count() === 0) {
- var now = new Date().getTime();
- // Create two users.
- var tomId = Meteor.users.insert({
- profile: {name: 'Tom Coleman'}
- });
- var tom = Meteor.users.findOne(tomId);
- var sachaId = Meteor.users.insert({
- profile: {name: 'Sacha Greif'}
- });
- var sacha = Meteor.users.findOne(sachaId);
- var telescopeId = Posts.insert({
- title: "Introducing Telescope",
- userId: sacha._id,
- author: sacha.profile.name,
- url: "http://sachagreif.com/introducing-telescope",
- submitted: new Date(now - 7 * 3600 * 1000),
- commentsCount: 2
- });
- Comments.insert({
- postId: telescopeId,
- userId: tom._id,
- author: tom.profile.name,
- submitted: new Date(now - 5 * 3600 * 1000),
- body: 'Interesting project Sacha, can I get involved?'
- });
- Comments.insert({
- postId: telescopeId,
- userId: sacha._id,
- author: sacha.profile.name,
- submitted: new Date(now - 3 * 3600 * 1000),
- body: 'You sure can Tom!'
- });
- Posts.insert({
- title: "Meteor",
- userId: tom._id,
- author: tom.profile.name,
- url: "http://meteor.com",
- submitted: new Date(now - 10 * 3600 * 1000),
- commentsCount: 0
- });
- Posts.insert({
- title: "The Meteor book",
- userId: tom._id,
- author: tom.profile.name,
- url: "http://themeteorbook.com",
- submitted: new Date(now - 12 * 3600 * 1000),
- commentsCount: 0
- });
- }
- else {
- Meteor._debug('Posts collection is not empty');
- }
|