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

Disallow empty path components in documents and queries

    • Type: Icon: Task Task
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Query Execution

      Empty string field names are allowed in json, and they are currently allowed in mongo documents. However there are many places in mongo code where empty string field names are not supported correctly, often because the empty string is used as an internal sentinel value in the implementation of various features.

      In addition to the linked cases, here are some others:

      Projection of an empty string field has opposite of desired effect:

      > c = db.c;
      test.c
      > c.drop();
      true
      > c.save( { '':'foo' } );
      > c.find( {}, { '':0 } );
      { "_id" : ObjectId("5037e1fd4764d2aca5d2cc35"), "" : "foo" }
      > c.find( {}, { '':1 } );
      { "_id" : ObjectId("5037e1fd4764d2aca5d2cc35") }
      

      FieldPath doesn't allow empty string field names (SERVER-6592), I think there are a number of cases where the aggregation framework won't handle them.

      Once we decide what to do about empty string fields we should do an audit to ensure we correctly implement the desired behavior.

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            aaron Aaron Staple
            Votes:
            2 Vote for this issue
            Watchers:
            13 Start watching this issue

              Created:
              Updated: