A middleware for the Monk MongoDB library that parses and filters document fields. Version 0.2.0 is the latest stable release. This package is part of the Monk middleware ecosystem and extracts the field selection logic into a separate module, allowing reusable field filtering in queries and updates. Unlike manual field projection, monk-middleware-fields provides a declarative way to include or exclude fields consistently across operations. It is designed to work with Monk versions that support middleware (v5+). No active development observed; project appears unmaintained.
npm install monk-middleware-fieldsVerified import paths — ran on the pinned version, not inferred.
Shows how to apply the fields middleware to a Monk collection and use field filtering in queries.
Consider using built-in MongoDB projection in Monk directly or find an alternative.
Ensure you instantiate the collection with the middleware: db.get('collection', { middlewares: [fields()] }).Upgrade to 0.2.0 or use dot notation manually.
Test with your Monk version; consider using Monk's built-in projection.
Use 'import fields from 'monk-middleware-fields'' instead of 'import { fields } from 'monk-middleware-fields''.Run 'npm install monk-middleware-fields'.
Pass { middlewares: [fields()] } when creating the collection.