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

Support $type inside of $in

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Querying
    • None
    • Query Optimization

    Description

      db.test.insert({a:1});
      db.test.insert({a:"1"});
       
      --------------------------------------------------------------------------------------------------------
       
      > db.test.find({a:{$type:"string"}})
      { "_id" : ObjectId("582420b599ec5f9dcc617115"), "a" : "1" }
      > db.test.find({a:{$type:"number"}})
      { "_id" : ObjectId("582420ad99ec5f9dcc617114"), "a" : 1 }
      
      

      No issues as of now, How can i select both string and numbers with in query

      > db.test.find({a:{$type:{$in:["string","number"]}}})
      Error: error: {
              "waitedMS" : NumberLong(0),
              "ok" : 0,
              "errmsg" : "argument to $type is not a number or a string",
              "code" : 14
      }
      

      Attachments

        Activity

          People

            backlog-query-optimization Backlog - Query Optimization
            guruskec@gmail.com guru rajan
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated: