fixtures.js 638 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * @file
  3. *
  4. *
  5. * User: marand
  6. * Date: 30/08/15
  7. * Time: 11:33
  8. */
  9. if (Posts.find().count() === 0) {
  10. var data = [
  11. {
  12. title: "Introducing Telescope",
  13. url: "http://sachagreif.com/introducing-telescope",
  14. author: "Sacha Greif"
  15. },
  16. {
  17. title: "Meteor",
  18. url: "http://meteor.com",
  19. author: "Tom Coleman"
  20. },
  21. {
  22. title: "The Meteor book",
  23. url: "http://themeteorbook.com",
  24. author: "Meteor Inc."
  25. }
  26. ];
  27. data.forEach(function (post) {
  28. Meteor._debug("Inserting", post);
  29. Posts.insert(post);
  30. });
  31. }
  32. else {
  33. Meteor._debug('Posts collection is not empty');
  34. }