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

$where queries involving an attribute with the word "return" anywhere in the name returns nothing

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.0
    • Affects Version/s: 1.3.1, 1.4.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Ubuntu Linux running inside VMWare server

      If you use the word 'return' as an attribute name, or the word return is even part of any attribute name (like 'returned_date' or 'wesasreturningsa') then you will not be able to use the "$where" to filter on that attribute - you will get negative result (zero rows) under all circumstances, so "$where"=>"this.returned_date == null || this.returned_date != null" will still return zero rows, even though logically that is impossible. It may be some kind overly broad string matching in the mongo database's handling of "$where". You will not see this problem in a traditional filter or in the context of a map/reduce. To get around it without having to mangle your models, you can (unappetizingly) construct your where clause like this: "$where"=>"this['r' + 'eturned_date'] == 'whatever'"

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            patrick_gannon Patrick Gannon
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: