Skip to content

Commit

Permalink
ignore attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
notPlancha authored Apr 14, 2024
1 parent 5e089b9 commit c0c38b4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/server/router/plural.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ module.exports = (db, name, opts) => {
// Remove q, _start, _end, ... from req.query to avoid filtering using those
// parameters
let q = req.query.q
const attr = req.query.attr
let _start = req.query._start
let _end = req.query._end
let _page = req.query._page
Expand All @@ -64,6 +65,7 @@ module.exports = (db, name, opts) => {
const _embed = req.query._embed
const _expand = req.query._expand
delete req.query.q
delete req.query.attr
delete req.query._start
delete req.query._end
delete req.query._sort
Expand Down Expand Up @@ -101,6 +103,10 @@ module.exports = (db, name, opts) => {

chain = chain.filter((obj) => {
for (const key in obj) {
if (attr && attr.indexOf(key) === -1) {
// ignore key(field)
continue
}
const value = obj[key]
if (db._.deepQuery(value, q)) {
return true
Expand Down

0 comments on commit c0c38b4

Please sign in to comment.