简体   繁体   中英

massive-js limit columns from result

The following code returns id, title and content fields. I need only id and title.

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

I need and an equivalent of "select id, title from laws where...". I can not find anything in the docs .

I would like to avoid a for loop to filter out unwanted columns, it is less efficient.

As you can see in the massive.js code, you have not option for remove id from result row in search method. My advice is use Inline SQL

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM