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

Wire protocol cannot handle some field names, even though they are not reserved

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Usability
    • ALL

      According to the documentation, only field names starting with `$` are reserved. But it seems that because of how the wire protocol is implemented (looking at what the drivers do, the documentation is a bit sparse here), certain field names take on a special meaning, such as "orderby" or "query":

      > db.test.insert({_id:123, orderby: 1, query: 2});
      > db.test.insert({_id:124, orderby: 2, query: 1});
      > db.test.find({orderby: 1})
        { "_id" : 123, "orderby" : 1, "query" : 2 }
      > db.test.find({query: {}, orderby: 1})
        error: { "$err" : "sort must be an object or array", "code" : 13513 }
      

      The wire protocol should be updated to use some kind of different scheme to avoid ambiguity, such as prefixing the special parts of the query with $ as happens in other places.

            Assignee:
            Unassigned Unassigned
            Reporter:
            thiloplanz Thilo Planz
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: