입력에서 필터 목록을 만드는 클래스가 있습니다. 필터는 다음과 같이 각 필터에 대한 함수를 호출하여 찾을 수 있습니다.
public void created_after(string date)
{
DateTime convertedDate = Convert.ToDateTime(date);
filters.Add(Builders<User>.Filter.Gte(x => x.Created, convertedDate));
}
이제 사용자의 자식 배열에있는 필드를 분할해야합니다. 이 경우 경고가 지정된 날짜보다 생성 된 값이 더 높은지 확인하면됩니다. 내 데이터는 다음과 같습니다.
{
"DisplayName" : "PestisanRadu",
"Alerts" : [
{
"UserId" : ObjectId("577a26a12b365917c4d67dd5"),
"Created" : ISODate("2016-10-05T09:17:44.382+0000")
},
{
"UserId" : ObjectId("577a26a82b365917c4d68009"),
"Created" : ISODate("2016-10-05T18:44:45.743+0000")
}
],
"Created" : ISODate("2016-10-05T09:17:43.423+0000")
}
수업이 작동하려면 FilterDefinition 유형을 유지해야합니다.
FieldDefinition
매개 변수로 사용하는 다른 동일한 방법을 사용하십시오.
filters.Add(Builders<User>.Filter.Gt("Alerts.Created", convertedDate));
문자열 "Alerts.Created"
은FieldDefinition
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다