keys

Projecting documents

Projection limits the fields to return for all matching documents, specifying the inclusion or the exclusion of fields.

This is done via the keys query parameter.

The system properties (properties starting with _ that are managed automatically by RESTHeart) are not affected by this option.

Examples

return just the property title

$ http GET 127.0.0.1:8080/test/coll?keys={'title':1}

return all but the property title

$ http GET 127.0.0.1:8080/test/coll?keys={'title':0}

return just the properties title and summary

$ http GET "127.0.0.1:8080/test/coll?keys={title:1}&keys={'summary':1}"

note that you specify multiple keys using multiple keys query parameters

Documentation references

How to use the examples

The examples make use of the brilliant httpie CLI HTTP client and are ment to be used with RESTHeart stareted on the localhost without the authentication enabled.

Eventually pass username and password with the -a username:password option.