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

system.profile query format inconsistent

    • Type: Icon: Improvement Improvement
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.2.7, 2.4.9, 2.6.0-rc1
    • Component/s: Diagnostics, Querying, Usability
    • None
    • Query Execution

      There are several schemas for how queries with/without sort are stored in system.profile. This makes it unnecessarily complex to run aggregation over system.profile collections that access the query patterns.

      There should be a single common format for all queries.

      simple find, no sort : query on top level

      db.docs.find({a: 1})
      
      	"query" : {
      		"a" : 1
      	},
      

      find with sort, query is nested in another query field, without $.

      db.docs.find({a: 1}).sort({b:1})
      
      	"query" : {
      		"query" : {
      			"a" : 1
      		},
      		"orderby" : {
      			"b" : 1
      		}
      	},
      

      $query / $orderby syntax, results in nested $query field with $.

      db.docs.find({ $query: {a: 1}, $orderby: {b: 1} })
      
      	"query" : {
      		"$query" : {
      			"a" : 1
      		},
      		"$orderby" : {
      			"b" : 1
      		}
      	},
      

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            thomas.rueckstiess@mongodb.com Thomas Rueckstiess
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: