mapreduce - Aggregating heterogeneous documents in MongoDB -
i writing tool inspect mongodb session store, in structure namespaces containing variables containing information on variables, roughly:
{ "some namespace" : { "some variable" : { "t" : "serialization type", "b" : "data value", "c" : "java class type" }, "some other variable in namespace" : { "t" : "serialization type", "b" : "data value", "c" : "java class type" }, ... }, ... // more namespaces }
the names of namespaces , variables different. wrote map-reduce job loop through namespaces , loop through variables in each namespace , emit each variable in each namespace.
however, want try switch mongo's aggregation framework avoid potential write lock problems. based on docs, seems have specify names of variables $group on, doesn't seem compatible heterogeneous data mine. there way involve iteration in aggregation invocation?
currently, use aggregation framework, have know field names write query. there some proposals remove limitation.
right now, given design, use aggregation framework, have consolidate @ regular intervals data using map-reduce more or less that:
{ namespaces: [ { name: "some namespace", variables: [ { name: "some variable", t : "serialization type", b : "data value", c : "java class type" }, { name: "some other variable in namespace", t : "serialization type", b : "data value", c : "java class type" }, ... // more variables ] }, ... // more namespaces ] }
now relatively easy query using aggregation framework. admitting may work on stale data...
Comments
Post a Comment