We are working on an app and need to be able to create new Mongo collections on the fly. Currently we have code such as this:
@Global = new Meteor.Collection('global')
We have a document in this mongo collections that looks like this:
{ "title" : "room_list", "room_list" : ['chat1', 'chat2'], ... }
Now I want to set up some type of loop or construct that would basically create the following
@chat1 = new Meteor.Collection('chat1')
@chat2 = new Meteor.Collection('chat2')
We are seeming to need this type of functionality to be able to create new collections of data on the fly.
We are looking into some type of dynamic variable declaration or is there a better way to dynamically create new meteor collections?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…