在Python Eve中投影在嵌套字段上

时间:2018-12-21 14:16:29

标签: python rest eve

我想在投影中排除一些嵌套字段
es:     http://eve-demo.herokuapp.com/people?projection= {“ location.address”:0} 但它会返回所有字段。

<resource href="people/5c193bcdb235a00004f149c8" title="person">
  <_created>Tue, 18 Dec 2018 18:26:21 GMT</_created>
  <_etag>46f3f23e77aef220d95c424ab69cf32239016d8e</_etag>
  <_id>5c193bcdb235a00004f149c8</_id>
  <_updated>Tue, 18 Dec 2018 18:26:21 GMT</_updated>
  <born>Sat, 23 Feb 1985 12:00:00 GMT</born>
  <firstname>Mark</firstname>
  <lastname>Green</lastname>
  <location>
    <address>4925 Lacross Road</address>
    <city>New York</city>
  </location>
  <role>copy</role>
  <role>author</role>
</resource>

但是,如果我在投影中包含相同的字段:
     http://eve-demo.herokuapp.com/people?projection= {“ location.address”:1} 它仅返回请求的字段“位置地址”

<resource href="people/5c193bcdb235a00004f149c8" title="person">
  <_created>Tue, 18 Dec 2018 18:26:21 GMT</_created>
  <_etag>46f3f23e77aef220d95c424ab69cf32239016d8e</_etag>
  <_id>5c193bcdb235a00004f149c8</_id>
  <_updated>Tue, 18 Dec 2018 18:26:21 GMT</_updated>
  <location>
    <address>4925 Lacross Road</address>
  </location>
</resource>

如何编写投影以从返回集合中排除特定的嵌套字段?

0 个答案:

没有答案