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

Operator $or(query) and operator $(projection) don't work together.

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.0.4
    • Component/s: Querying
    • None
    • ALL

      QUERY:

      db.users.find({
                                  $or: [
                                      {
                                              _id: senderId,
                                              "_contacts._profile_id": recipientId
                                      },
                                      {
                                          _id: recipientId,
                                          "_contacts._profile_id": senderId
                                      }
                                  ]
      },
      {
      "_contacts.$": 1
      })
      

      ERROR:
      BadValue positional operator (_contacts.$) requires corresponding field in query specifier","code":17144} must be equivalent to undefined

            Assignee:
            wan.bachtiar@mongodb.com Wan Bachtiar
            Reporter:
            rwander Roman
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: