Created
April 2, 2014 15:24
-
-
Save mrw34/9936336 to your computer and use it in GitHub Desktop.
meteor-with
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
{{> hello}} | |
</body> | |
<template name="hello"> | |
{{#with people}} | |
{{count}} | |
{{/with}} | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
People = new Meteor.Collection('people'); | |
if (Meteor.isClient) { | |
Template.hello.people = function() { | |
return People.find(); | |
}; | |
} | |
if (Meteor.isServer) { | |
if (!People.findOne()) { | |
People.insert({name: 'Joe'}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should not work since count is not a property of people. Also, people is a cursor so if there is more than one document, it will be vague what to expect of count.