Skip to content

Instantly share code, notes, and snippets.

@dwinston
Last active December 30, 2015 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwinston/7865309 to your computer and use it in GitHub Desktop.
Save dwinston/7865309 to your computer and use it in GitHub Desktop.
<head>
</head>
<body>
</body>
GameMaps = new Meteor.Collection('gameMaps');
if (Meteor.isClient) {
Meteor.subscribe('allMaps');
}
if (Meteor.isServer) {
Meteor.publish('allMaps', function() {
return GameMaps.find();
});
Meteor.startup(function () {
if (GameMaps.find().count() === 0) {
GameMaps.insert({
name: 'foo',
structure: {
arg1: 'bar',
fields: [
{name: 'someName', value: 'someValue'},
{name: 'someOtherName', value: 'someOtherValue'}
]
}
});
}
});
}
@dwinston
Copy link
Author

dwinston commented Dec 8, 2013

I call GameMaps.findOne({name: 'foo'}).structure.fields[0] from the client console and get {name: "someName", value: "someValue"}
This worked with and without the autopublish package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment