Created
May 8, 2017 00:25
-
-
Save AlexeyMK/84ed89aaa30da0aea9170974f038955e to your computer and use it in GitHub Desktop.
original implementation of exposing collections dynamically
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
# https://github.com/gterrono/houston/blob/4ec16866346abc1b08e761d62441a56fd93a7e99/server/list_view.coffee | |
Dummy = new Meteor.Collection("system.dummy") # hack. | |
collections = {} | |
Meteor.startup( -> | |
console.log collections | |
Dummy.findOne() # hack | |
Meteor._RemoteCollectionDriver.mongo.db.collections (meh, collections) -> | |
collection_names = (col.collectionName for col in collections \ | |
when (col.collectionName.indexOf "system.") isnt 0) | |
for name in collection_names | |
if name not in collections | |
collections[name] = new Meteor.Collection(name) | |
# TODO admin user only | |
Meteor.publish "admin_#{name}", -> collections[name].find({}) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment