javascriptstronglooploopbackjs

How to get result with specific fields in StrongLoop?


I am currently using StrongLoop as my API backend server and Mongodb as data storage engine.

Let's say there is a collection called article. It has two fields title, and content. And there are two frontend pages to display a list of articles and view a single article.

Obviously the data list page only need title field and the view page need both. Currently the GET method of StrongLoop API return all fields including content. It cost extra traffic. Is there any way that can just return specific field?

Mongodb support projection in find() method for this. How can I do the same thing by StrongLoop?


Solution

  • Have you taken a look at the filters offered. http://docs.strongloop.com/display/LB/Querying+models