2

I want to exclude some nested field with the projection
es: http://eve-demo.herokuapp.com/people?projection={"location.address":0} but it returns all fields.

<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>

However if I include the same field with the projection:
http://eve-demo.herokuapp.com/people?projection={"location.address":1} It returns only the requested field "location address"

<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>

How can I write a projection to exclude a specific nested field from my return collection?

Timo
  • 2,212
  • 2
  • 25
  • 46
pCrist001
  • 21
  • 2
  • If you wish to return the other fields from embedded document, this seems to work `http://eve-demo.herokuapp.com/people?projection={"location.city":1}`. Only city will be returned. – gcw Dec 21 '18 at 17:13

0 Answers0