我有一个多位数类别表,我想从该表中查询底部类别。
这样,我可以在查询时获得第一位数字,但不会带来低位数字
var query = Query<Category>.ElemMatch(x => x.SubCategories, builder => builder.EQ(actor => actor.IntegrationCategoryCode, categoryId));
var repository = new Data.MongoDB.Repository.MongoRepository<Category>();
var result= repository.CustomQuery(query).ToList();
[CollectionName("Category ")]
public class Category : Base.Entity
{
[BsonElement("CategoryId")]
public int CategoryId { get; set; }
[BsonElement("IntegrationCategoryName")]
public string IntegrationCategoryName { get; set; }
[BsonElement("IntegrationCategoryCode")]
public string IntegrationCategoryCode { get; set; }
[BsonElement("IntegrationParentCode")]
public string IntegrationParentCode { get; set; }
[BsonElement("Deleted")]
[BsonRepresentation(BsonType.Boolean)]
public bool Deleted { get; set; }
[BsonElement("CreateDate")]
[BsonDateTimeOptions(Kind = DateTimeKind.Utc)]
public DateTime CreateDate { get; set; }
[BsonElement("UpdateDate")]
[BsonDateTimeOptions(Kind = DateTimeKind.Utc)]
public DateTime UpdateDate { get; set; }
public List<Category> SubCategories { get; set; }
}