ドキュメントとリスト フィールドが埋め込まれた 2 つのビューがありfilteringquery
、以下の基準が必要です。
class myfriends(EmbeddedDocument):
myfriends_ids = StringField()
status = StringField()
class Friends(Document):
friend1 = ReferenceField(User)
myfriendslist = ListField(EmbeddedDocumentField(myfriends))
そして、次のような保存された値:
{ "_id" : ObjectId("542506f9bed069156ddd4476"),
"friend1" : ObjectId("542314b7bed0691c5302662c"),
"myfriendslist" : [
{
"myfriends_ids" : "5421ae74bed0691471e95b92",
"status" : "1"
} ]
}
django mongoengine に基づいて特定のレコードを取得するクエリが必要ですfriend1
。myfriends_ids