A lightweight utility for applying MongoDB-like query filters (e.g., $eq, $gte, $in, $regex) to plain JavaScript objects. Version 0.4.0 is current, with stable API and low release cadence. Key differentiator: no database dependency, pure in-memory filtering. Supports nested fields, dot notation, and most MongoDB operators.
npm install unified-mongo-filterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Filters an array of objects using a MongoDB-style query with $or and $gte operators.
Use new RegExp('pattern', 'flags') or string '/pattern/flags'.Ensure filter keys use dot path for nested fields, e.g., 'address.city'.
Validate field is array before applying $elemMatch.
Use {$exists: false} for missing keys, not $ne: null.Use import { matches } from 'unified-mongo-filter' or dynamic import.Ensure filter values are objects with operator keys, e.g., { age: { $gte: 18 } }.Use only supported operators: $eq, $ne, $gt, $gte, $lt, $lte, $in, $nin, $regex, $exists, $type, $elemMatch, $and, $or, $not, $nor, $where, $expr.
No dependency data recorded yet.