由mongoengine文档模型创建的文档,是否有一种方法可以实现代理模型(类似于django mysql代理模型)?

时间:2018-11-29 02:13:41

标签: django mongoengine

如何在Django中使用mongoengine实现代理模型 作为mysql后端? 例如:

import requests
import requests_toolbelt

auth = requests_toolbelt(username,password)
req = requests.get(url,auth=auth)

代理模型

import datetime
from mongoengine import signals, document, StringField, BooleanField, DictField, DateTimeField, IntField, DynamicDocument, ListField, EmbeddedDocument, EmbeddedDocumentField
class Job(document.Document):
    task_id = StringField(null=False)
    employees = ListField(field=IntField())
    flows = ListField(field=IntField())
    execute_time = DateTimeField(default=datetime.datetime.now)
    finished_time = DateTimeField()
    meta = {
        "indexes": [
            'task_id',
        ],
        'collection': 'job',
        'strict': False,
        'auto_create_index': False,
        'allow_inheritance': True
    }

Job创建的文档,无法通过jobproxy.ojbects进行查询,mongoengine中是否有任何支持的方法?

0 个答案:

没有答案