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

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • None
    • 1.8.2
    • Setup
    • microsoft winodws , visual studio 2010 ,mongodb 2.4.3

    Description

      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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: