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

Dot notation in Projections not working

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • None
    • Affects Version/s: 2.4.7
    • Component/s: Querying
    • Environment:
      CentOS 6.4
    • Linux
    • Hide

      I have the following documents

      /* 0 */
      {
      "_id" :

      { "rowId" : "d8a908fc-c549-4485-8610-c2893334211e", "a" : "0" }

      ,
      "Updated Time" : ISODate("2013-09-24T14:26:02.288Z"),
      "geoPoint1" :

      { "coordinates" : [ -122.8112, 38.8047 ] }

      }

      /* 1 */
      {
      "_id" :

      { "rowId" : "c7851807-6107-4262-bb26-711c8902a7c4", "a" : "0" }

      ,
      "Updated Time" : ISODate("2013-09-25T01:43:56.400Z"),
      "geoPoint1" :

      { "coordinates" : [ -116.444, 33.429 ] }

      }

      /* 2 */
      {
      "_id" :

      { "rowId" : "629b047c-7c40-4f8d-958b-4bf43858b1d0", "a" : "0" }

      ,
      "Updated Time" : ISODate("2013-09-25T01:42:29.821Z"),
      "geoPoint1" :

      { "coordinates" : [ -148.8046, 62.9881 ] }

      }

      If I run
      db['dbname'].find({},

      { _id: 0, "Updated Time" : 1, "geoPoint1.coordinates" :1}

      ) I get back all the documents without the ID as expected

      /* 0 */
      {
      "Updated Time" : ISODate("2013-09-24T14:26:02.288Z"),
      "geoPoint1" :

      { "coordinates" : [ -122.8112, 38.8047 ] }

      }

      /* 1 */
      {
      "Updated Time" : ISODate("2013-09-25T01:43:56.400Z"),
      "geoPoint1" :

      { "coordinates" : [ -116.444, 33.429 ] }

      }

      /* 2 */
      {
      "Updated Time" : ISODate("2013-09-25T01:42:29.821Z"),
      "geoPoint1" :

      { "coordinates" : [ -148.8046, 62.9881 ] }

      }

      If I do db['dbname'].find({},

      { _id: 0, "Updated Time" : 1, "geoPoint1.coordinates.0" :1}

      ) I get the following

      /* 0 */
      {
      "Updated Time" : ISODate("2013-09-24T14:26:02.288Z"),
      "geoPoint1" :

      { "coordinates" : [] }

      }

      /* 1 */
      {
      "Updated Time" : ISODate("2013-09-25T01:43:56.400Z"),
      "geoPoint1" :

      { "coordinates" : [] }

      }

      /* 2 */
      {
      "Updated Time" : ISODate("2013-09-25T01:42:29.821Z"),
      "geoPoint1" :

      { "coordinates" : [] }

      }

      /* 3 */
      {
      "Updated Time" : ISODate("2013-09-25T01:30:26.305Z"),
      "geoPoint1" :

      { "coordinates" : [] }

      }

      Show
      I have the following documents /* 0 */ { "_id" : { "rowId" : "d8a908fc-c549-4485-8610-c2893334211e", "a" : "0" } , "Updated Time" : ISODate("2013-09-24T14:26:02.288Z"), "geoPoint1" : { "coordinates" : [ -122.8112, 38.8047 ] } } /* 1 */ { "_id" : { "rowId" : "c7851807-6107-4262-bb26-711c8902a7c4", "a" : "0" } , "Updated Time" : ISODate("2013-09-25T01:43:56.400Z"), "geoPoint1" : { "coordinates" : [ -116.444, 33.429 ] } } /* 2 */ { "_id" : { "rowId" : "629b047c-7c40-4f8d-958b-4bf43858b1d0", "a" : "0" } , "Updated Time" : ISODate("2013-09-25T01:42:29.821Z"), "geoPoint1" : { "coordinates" : [ -148.8046, 62.9881 ] } } If I run db ['dbname'] .find({}, { _id: 0, "Updated Time" : 1, "geoPoint1.coordinates" :1} ) I get back all the documents without the ID as expected /* 0 */ { "Updated Time" : ISODate("2013-09-24T14:26:02.288Z"), "geoPoint1" : { "coordinates" : [ -122.8112, 38.8047 ] } } /* 1 */ { "Updated Time" : ISODate("2013-09-25T01:43:56.400Z"), "geoPoint1" : { "coordinates" : [ -116.444, 33.429 ] } } /* 2 */ { "Updated Time" : ISODate("2013-09-25T01:42:29.821Z"), "geoPoint1" : { "coordinates" : [ -148.8046, 62.9881 ] } } If I do db ['dbname'] .find({}, { _id: 0, "Updated Time" : 1, "geoPoint1.coordinates.0" :1} ) I get the following /* 0 */ { "Updated Time" : ISODate("2013-09-24T14:26:02.288Z"), "geoPoint1" : { "coordinates" : [] } } /* 1 */ { "Updated Time" : ISODate("2013-09-25T01:43:56.400Z"), "geoPoint1" : { "coordinates" : [] } } /* 2 */ { "Updated Time" : ISODate("2013-09-25T01:42:29.821Z"), "geoPoint1" : { "coordinates" : [] } } /* 3 */ { "Updated Time" : ISODate("2013-09-25T01:30:26.305Z"), "geoPoint1" : { "coordinates" : [] } }

      Using dot notation in projections does not work as expected.

            Assignee:
            Unassigned Unassigned
            Reporter:
            vegaed Edgardo Vega
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: