Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
subtract-query-filter
Advanced tools
You need to fetch a lot of data from a remote server (with a filter that is defined on client-side and executed on server-side).
You want to fetch additional data of the same type, but you do not want to load documents a second time.
You could now include something like { _id: { $nin: [ ... a lot of ids ] } }
to your filter.
This package offers a different approach: You just have to subtract the previously used filter from your new one.
You implemented a calender with a day- and a month-view. There are a lot of events each there (therefore its expensive to exclude already fetched ids from new queries).
The user navigates through the app:
Time span fetched | Internal query | Query to server |
---|---|---|
02.01. | {date: {$in: [02.01.]} | {date: {$in: [02.01.]} |
01.01. - 07.01. | {date: {$gte: '01.01.', $lte: '07.01.' | {date: {$gte: '01.01.', $lte: '07.01.', $nin: [02.01.] |
04.01. - 10.01. | {date: {$gte: '04.01.', $lte: '10.01.' | {date: {$gt: '07.01.', $lte: '10.01.'} |
All of this does only make since if you need to fetch a lot of data or really must reduce the transferred data to a minimum.
If you don't, you might want to just fetch that data a second time.
export type FilterConstraint = {
$in?: any[];
$nin?: any[];
$lt?: any;
$gt?: any;
$lte?: any;
$gte?: any;
}
export interface Filter {
[key: string]: FilterConstraint;
}
The operations are restricted to the above.
{ $eq: VAL }
must be expressed as { $in: [ VAL ] }
.
{ $ne: VAL }
must be expressed as { $nin: [ VAL ] }
.
So far, it is not possible to use query operators like $and, $or, $all etc...
FAQs
Subtracting filters analytically.
The npm package subtract-query-filter receives a total of 2 weekly downloads. As such, subtract-query-filter popularity was classified as not popular.
We found that subtract-query-filter demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.