Uploaded image for project: 'Entity Framework'
  1. Entity Framework
  2. EF-199

Querying != null, is comparing with root when list of completing object

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 8.3.0, 9.0.0
    • Affects Version/s: None
    • None
    • None
    • Dotnet Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      For testing i simple putĀ  e != null and e.Permissoes != null, is comparing with root anytime with List<Type>for example:

      var x = _context.GetDbSet<Operador>().Where(e => e != null && e.Permissoes != null e.Permissoes.Any(s=> s.Semantica == PermissaoSemantica.Despacho)).Select(e => e.Sigla).ToArray();

      Where Permissoes is a list of some object, is gererating the following query, and for this properties with null value by anycase is not bein removed from the search and crashing on e.Permissoes.Any causing: 'Command getMore failed: Executor error during getMore :: caused by :: $anyElementTrue's argument must be an array, but is null'

      { "$match" : { "$and" : [{ "$expr" :

      { "$ne" : ["$$ROOT", null] }

      }, { "$expr" :

      { "$ne" : ["$$ROOT", null] }

      }, { "$expr" : { "$anyElementTrue" : { "$map" : { "input" : "$Permissoes", "as" : "o0", "in" :

      { "$eq" : ["$$o0.Semantica", 0] }

      } } } }] } }, { "$project" :

      { "_v" : "$Sigla", "_id" : 0 }

      }

            Assignee:
            damien.guard@mongodb.com Damien Guard
            Reporter:
            marcelo@feodrippe.com Marcelo Feodrippe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: