2016-11-11 58 views
1

使用教程(http://python-eve.org/features#embedded-resource-serialization)的例子:是否可以在嵌入式文档上查询?

DOMAIN = { 
'emails': { 
    'schema': { 
     'author': { 
      'type': 'objectid', 
      'data_relation': { 
       'resource': 'users', 
       'field': '_id', 
       'embeddable': True 
      }, 
     }, 
     'subject': {'type': 'string'}, 
     'body': {'type': 'string'}, 
    } 
} 

是否可以查询author.name“尼古拉Iarocci”为例的电子邮件?我试过

/emails?where={"author.name":"Nikola Iarocci"}&embbeded={"author":1} 

但它不起作用。

它适用于嵌入文档,但不适用于嵌入文档。

回答

0

这是不可能的,因为它不受MongoDB本身的支持。您可能需要考虑Eve 0.7支持的Aggregation Framework(开发中,但您可以安装它)。

相关问题