Json response / records without "resource" and document id

How do I prevent the REST API from returning the Document Id (in this case its from MongoDB) in the result? As a matter of fact I would just want to fetch the value of “geojson”, without even needing to have the fieldname in the result. Is that possible? Thanks

I would want this result
{"resource":[{"_id":"5708290f7d57d023123c9873","geojson":{"geometry":{"type":"Point","coordinates":[103.697455,1.3547433]},"type":"Feature","properties"}

to look like this
{"geometry": {"type": "Point", "coordinates": [103.697455, 1.3547433]}, "type": "Feature", "properties"}

I know I can manipulate it once I get it but can I use the API itself to return it in the format shown above?

Hi @m_menon,

To remove the “resource” wrapper, set always_wrap_resources to false in this two files:
{DF_ INSTALATION}/apps/dreamfactory/htdocs/config/df.php
and
{DF_ INSTALATION}/apps/dreamfactory/htdocs/bootstrap/cache/config.php

To receive just the fields you want, use the fields param in your REST URL ex.:
GET http://localhost:8080/api/v2/mongodb/_table/teste?fields=coordinates,type

I hope this helps! :slight_smile:

1 Like

Great thanks :thumbsup::relaxed: