如何在strongloop loopback中通过rest调用获取特定属性名称

时间:2015-08-20 06:29:29

标签: rest loopbackjs strongloop

我正在让学生在环回模型中使用此网址通过休息访问。 /api/students休息电话会提供所有学生数据,但我只想获得学生的注册号码(regno)。就像在sql(SELECT regno FROM students)中一样。我应该如何过滤上述休息电话,只获得学生的注册号码。

2 个答案:

答案 0 :(得分:1)

使用字段过滤器。

?filter[fields][regno]=true

https://docs.strongloop.com/display/public/LB/Fields+filter

答案 1 :(得分:1)

?filter={"fields":"regno"}

如果您想获得多列

?filter={"fields":["regno","column2","column3",....]}