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

Query with $gt with Alphabate includes the results with Criteria

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
    • Environment:
      NA
    • ALL

      See below query,

      db.first.find({name:{$gt:"A"}})
      { "_id" : ObjectId("5487373f1b8027ac7cddd0ab"), "name" : "Amit", "age" : 30, "gender" : "M" }
      { "_id" : ObjectId("548737b71b8027ac7cddd0ac"), "name" : "Amogh", "age" : 5, "gender" : "M" }
      { "_id" : ObjectId("548737f81b8027ac7cddd0ad"), "name" : "Poonam", "age" : 29, "gender" : "F" }
      

      Because I am filtering the Collection based on Names greater than "A", where I should expect result shown as only below,

      { "_id" : ObjectId("548737f81b8027ac7cddd0ad"), "name" : "Poonam", "age" : 29, "gender" : "F" }
      

      It displays all Three documents even with the name starting as "A".

      If this is correct functionality, then what $gte:"A" should print out the documents?

      Please let me know if you need any further details.

      Thanks,
      Amit

            Assignee:
            ramon.fernandez@mongodb.com Ramon Fernandez Marina
            Reporter:
            amit.kshirsagar.13@gmail.com Amit Kshirsagar
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: