large-js限制结果列

时间:2016-11-05 18:12:21

标签: javascript node.js massivejs

以下代码返回id,title和content字段。我只需要id和title。

  db.laws.search({columns: ["title", "content"], term: req.params.text}, function(err,laws){
    res.contentType('application/json');
    res.send(JSON.stringify(laws));
  });

我需要和等同于"从法律中选择ID,标题......"。我在docs中找不到任何内容。

我想避免使用for循环来过滤掉不需要的列,效率会降低。

1 个答案:

答案 0 :(得分:0)

正如您在massive.js代码中看到的那样,您无法从id方法中的结果行中删除search。 我的建议是使用Inline SQL