1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- // 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
- });
- for (var i = 0; i < 10; i++) {
- Posts.insert({
- title: 'Test post #' + i,
- author: sacha.profile.name,
- userId: sacha._id,
- url: 'http://google.com/?q=test-' + i,
- submitted: new Date(now - i * 3600 * 1000),
- commentsCount: 0
- });
- }}
- else {
- Meteor._debug('Posts collection is not empty');
- }
|