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

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -