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

Disallow empty path components in documents and queries

    XMLWordPrintable

Details

    • Task
    • Status: Backlog
    • Major - P3
    • Resolution: Unresolved
    • None
    • None
    • Querying
    • None

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

              backlog-query-execution Backlog - Query Execution
              aaron Aaron Staple
              Votes:
              2 Vote for this issue
              Watchers:
              13 Start watching this issue

              Dates

                Created:
                Updated: