Search by condition with method Any (Linq) returns 0 documents when filter has OR condition

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: LINQ, LINQ3
    • None
    • Fully Compatible
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      1) List<PartyUser> users1 = userRepository.GetList(c => c.Roles.Any(r => r == UserRoles.Admin));

      2) List<PartyUser> users2 = userRepository.GetList(c => c.Roles.Any(r => r == UserRoles.Admin || r == UserRoles.Editor));

       

      First line returns 3 elements, but second line is 0, even it has wider filter and there a lot of documents with UserRoles.Editor.

       

      public List<T> GetList(Expression<Func<T, bool>> where)

      { return Db.GetCollection<T>(CollectionName).Find(where).ToList(); }

      Where Db is IMongoDatabase

      2.7.0 Beta1

              Assignee:
              Robert Stam
              Reporter:
              Roman Buchyn
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated: