Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1359

Positional ($) projection not working properly in v3?

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.0.4
    • Component/s: None
    • Labels:
    • Environment:
      Node v4.8.2, Debian 8.

      We have recently upgraded from node drive v2.2 to v3, and have noticed that some of our queries are behaving differently. I've looked at the breaking changes document, and can't see anything relevant.

      Query:

      dbCollection.findOne(
                              { aId: a, 'pi.Id' : b },
                              { "pi.$" : 1  },
                              function(err, result) {}
      )
      

      Result with v2:

      { _id: 5a9e8594c926462d20f1f14f,
        pi:
         [ 
      	{ 	Id: 5a9e85a9f2b3052aa8fd7d37,
             		Uid: 5a0db4b5409339cc35ff4f38 } 
         ] 
      }
      

      Result with v3:

      { _id: 5a9e8594c926462d20f1f14f,
        aId: 5a9e8594c926462d20f1f14e,
        p:
         [ { Id: 5a9e859412e41f2d20b888a3,
             Tid: 000000000000000000000001},
           { Id: 5a9e85a9f2b3052aa8fd7d37,
             Tid: 5a96ce19ca25c326f8306900}],
        pi:
         [ { Id: 5a9e859412e41f2d20b888a3,
             Uid: 000000000000000000000001 },
           { Id: 5a9e85a9f2b3052aa8fd7d37,
             Uid: 5a0db4b5409339cc35ff4f38 } ],
      }
      

      In the v3 result, it looks like the positional projection part of the query

      { "pi.$" : 1 }

      is being ignored. Am I missing something here, or is this a bug?

      Thank you

            Assignee:
            Unassigned Unassigned
            Reporter:
            bgsosh@gmail.com Scott Lowe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: