Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-65

LINQ Query returns non empty result collection when it shouldn't

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: SAMUS
    • None

      Given the following entity and an empty collection in the database:

      public class Post
      {
      [MongoId]
      public Guid Id

      { get; set; }

      public DateTime LastAccess { get; set; }

      public List<string> Tags

      { get; set; }

      }

      The following query should return an empty list but it returns a list containing a single empty Post entity:

      List<string> SearchTags = new List<string>

      {"test"}

      ;

      var result = SearchTags.Aggregate(posts.Linq(), (current, tag) => current.Where(x => x.Tags.Any(t => t == tag))).OrderByDescending(
      x => x.LastAccess).Skip(skip).Take(take).ToList();

            Assignee:
            sam Sam Corder
            Reporter:
            oliverw Oliver Weichhold
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: