我有一个名为的文档login_info
,其中包含以下字段:
class login_info(Document):
user_name = StringField(max_length=120)
password = StringField(max_length=120)
email = EmailField()
gender = StringField(max_length=120)
date_of_birth = DateTimeField()
visibility = StringField(max_length=120)
client_id = ObjectIdField(required=False)
location = ListField(EmbeddedDocumentField("Tracking"))`
在上述字段location
中是一个嵌入文档,其中包含以下字段:
时间
纬度,
经度
我想从此嵌入文档中删除满足以下条件的值。
time < system_datetime
.
以下是login_info
文档中的示例数据:
{
"_cls":"login_info",
"_id":ObjectId("5046f43c12d0592e3f59e25d"),
"_types":[
"login_info"
],
"date_of_birth":ISODate("2011-02-07T00:00:00 Z"),
"email":"jack@gmail.com",
"expire":1346827684,
"gender":"male",
"issue":1346827324,
"key":"47d1e64e51dfa1cf99ce4a59e0c940",
"location":[
{
"Latitude":"5615.3111",
"_types":[
"Tracking"
],
"_cls":"Tracking",
"Longitude":"1236.711",
"time":ISODate("2012-09-13T12:24:36.051 Z")
},
{
"Latitude":"000",
"_types":[
"Tracking"
],
"_cls":"Tracking",
"Longitude":"3.70",
"time":ISODate("2012-09-25T18:30:57.756 Z")
},
{
"Latitude":"11",
"_types":[
"Tracking"
],
"_cls":"Tracking",
"Longitude":"1",
"time":ISODate("2012-09-26T10:25:29.157 Z")
},
{
"Latitude":"11",
"_types":[
"Tracking"
],
"_cls":"Tracking",
"Longitude":"1",
"time":ISODate("2012-09-26T10:40:58.895 Z")
},
{
"Latitude":"11",
"_types":[
"Tracking"
],
"_cls":"Tracking",
"Longitude":"1",
"time":ISODate("2012-09-26T10:54:08.361 Z")
},
{
"Latitude":"11",
"_types":[
"Tracking"
],
"_cls":"Tracking",
"Longitude":"1",
"time":ISODate("2012-09-26T11:08:55.873 Z")
}
],
"password":"jack",
"refresh_token":"22580a8f69",
"token":"bac8a5f863",
"user_name":"jack",
"visibility":"visible"
}