Created
October 7, 2015 15:10
-
-
Save alex2006hw/c93d8c387f2891e36357 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// http://stackoverflow.com/questions/28787886/meteor-database-connection | |
if (Meteor.isServer) { | |
var database = new MongoInternals.RemoteCollectionDriver("mongodb://127.0.0.1:3001/meteor"); | |
Boxes = new Mongo.Collection("boxes", { _driver: database }); | |
Meteor.publish('boxes', function() { | |
return Boxes.find(); | |
}); | |
} | |
if (Meteor.isClient) { | |
Boxes = new Mongo.Collection("boxes"); | |
Meteor.subscribe('boxes'); | |
Template.homeCanvasTpl.helpers({ | |
boxes: function () { | |
return Boxes.find({}); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment