jquery - Is it possible to generate dynamically-named MongoDB Collections? -
normally, mongodb collections defined this:
duckbilledplatypi = new mongo.collection("duckbilledplatypi");
i want to, though, dynamically generate collections based on user input. example, might want be:
rupertpupkin20151212_20151218 = new mongo.collection("rupertpupkin20151212_20151218");
it easy enough build collection name:
var dyncollname = username + begindate +'_'+ enddate;
...and pass "dyncollname") mongo.collection:
= new mongo.collection(dyncollname);
...but collection instance name - how can dynamically generated? need like:
"rupertpupkin20151212_20151218".torawname() = new mongo.collection(dyncollname);
-or:
"rupertpupkin20151212_20151218".unstringify() = new mongo.collection(dyncollname);
...but afaik, there's no such thing...
on single client instance, yes, , dynamically reference it. in general case (using sync data between server , connected clients), no.
i address point in dynamically created collections section of common mistakes in little detail, fundamental problem highly complex connected clients agree on dynamically generated set of collections.
it's more finite set of collections have flexible schema, want. andrew mao points out in answer this related question, partitioner tool available address cases give rise question.
Comments
Post a Comment