Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2819

More control over output result format

    • Type: Icon: Improvement Improvement
    • Resolution: Gone away
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 1.8.0
    • Component/s: Querying
    • None
    • Environment:
      Ubuntu Server 10 64-bit
    • Query Optimization

      In the current state of Mongo a query will return the results intended, but also the whole structure of the document itself. This can be quite cumbersome as my ideal usage for MongoDB is to query and then take the outputted BSON to a JSON format. Having the whole document returned despite asking for a small chunk means I will need to drill down into the JSON output until I get to my actual results. What would be better is to have a generic results container document that encapsulates my results or the ability to rewrite the output format in a query-like syntax (SQL => SELECT data AS myoutput ...). To further illustrate the issue, I have included an example below.

      When I do a query for the following:
      db.malware.find({},{"contents.objects.object.length":1, "_id":0});

      I get the following for every document in my collection:

      { "contents" : { "objects" : { "object" : [ 
              { 
                      "length" : 43 
              }, 
              { 
                      "length" : 37 
              }, 
              { 
                      "length" : 22 
              } 
      ] } } } 
      

      What would be ideal is something like:

      {  "result" : [ 
              { 
                      "length" : 43 
              }, 
              { 
                      "length" : 37 
              }, 
              { 
                      "length" : 22 
              } 
      ] }
      

            Assignee:
            backlog-query-optimization [DO NOT USE] Backlog - Query Optimization
            Reporter:
            9bplus Brandon Dixon
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: