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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Gone away
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Usability
    • Labels:
    • Operating System:
      ALL

      Description

      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.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved: