Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-204

mapping issue with nested JSON in MongoDB

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      It looks like nested JSON map-elements cannot be correctly referenced in MongoDB right now. Although I understand MongoDB aggregation framework doesn't allow referencing a specific element from an array (https://jira.mongodb.org/browse/SERVER-4589), but it could be done for JSON/object elements.

      For documents like this...
      ```
      {
      ...
      "days_since_join" : NumberLong(0),
      "dim_tech" :

      { "calling_medium" : "mobile" }

      ,
      "dim_user" :

      { "age" : NumberLong(19), "age_group" : "18-24", ... }

      }
      ```
      If we do aggregation using SQL
      ```
      SELECT calling_medium, count FROM visits GROUP BY calling_medium;
      ```

      The aggregation pipeline should be something like
      ```
      db.visits.aggregate(
      {
      $group:{
      _id:"$dim_tech.calling_medium",
      count:{$sum:1}
      }
      }
      )
      ```
      A dot (.) sign could distinguish the hierarchy.

      ---------------- Imported from GitHub ----------------
      Url: https://github.com/julianhyde/optiq/issues/204
      Created by: tikazyq
      Labels:
      Created at: Tue Mar 25 01:41:14 CET 2014
      State: open

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              github-import GitHub Import
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated: