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

Query with $gt with Alphabate includes the results with Criteria

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Works as Designed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
    • Environment:
      NA
    • Operating System:
      ALL

      Description

      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

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: