fixtures.js 551 B

123456789101112131415161718192021222324252627282930313233
  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. },
  15. {
  16. title: "Meteor",
  17. url: "http://meteor.com"
  18. },
  19. {
  20. title: "The Meteor book",
  21. url: "http://themeteorbook.com"
  22. }
  23. ];
  24. data.forEach(function (post) {
  25. Meteor._debug("Inserting", post);
  26. Posts.insert(post);
  27. });
  28. }
  29. else {
  30. Meteor._debug('Posts collection is not empty');
  31. }