2016-11-11 75 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(開發中,但您可以安裝它)。

相關問題