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

Nested object list and query nested columns,but doesn't match any value

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.8.2
    • Component/s: Setup
    • Environment:
      microsoft winodws , visual studio 2010 ,mongodb 2.4.3

      detail is here

      table Imb_MicroBlog

      public class Imb_MicroBlog{
         public Guid _id { get; set; }
         public Guid createUserID { get; set; }
         public List<Imb_Comment> commentList { get; set; }
         public bool isAudit{ get; set ; }
         public string content{ get; set ; }
      }
      

      table Imb_Comment

      public class Imb_Comment{
         public Guid _id { get; set; }
         public Guid createUserID { get; set; }
         public bool isAudit{ get; set ; }
         public string content{ get; set ; }
      }
      

      when i want to match nested Imb_Comment's cloumns isAudit=true and Slice them
      C# like this

      collection.Find(
          Query.And(
              Query.EQ("_id", microblogID), 
              Query.EQ("commentList.isAudit", True)
          )
      )
      .SetFields(Fields.Slice("commentList", skip, limit))
      .ToList()
      [0].commentList[0].replyList.Count;
      

      but it match all rows include isAudit=false, i don't how to query nested item ,hope help me thanks very much

            Assignee:
            Unassigned Unassigned
            Reporter:
            bivozeou bivozeou
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: