12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- // Fixture data.
- 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');
- }
|