{"library":"monk-middleware-fields","title":"monk-middleware-fields","description":"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.","language":"javascript","status":"maintenance","last_verified":"Sat Apr 25","install":{"commands":["npm install monk-middleware-fields"],"cli":null},"imports":["import fields from 'monk-middleware-fields'","const fields = require('monk-middleware-fields')","import monk from 'monk'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import monk from 'monk';\nimport fields from 'monk-middleware-fields';\n\nconst db = monk('localhost/mydb');\nconst users = db.get('users', { middlewares: [fields()] });\n\n// Insert a user\nawait users.insert({ name: 'John', email: 'john@example.com', age: 30 });\n\n// Query with fields: only name and email\nconst result = await users.findOne({}, { fields: { name: 1, email: 1 } });\nconsole.log(result); // { _id: ..., name: 'John', email: 'john@example.com' }\n\n// Or exclude fields\nconst result2 = await users.findOne({}, { fields: { age: 0 } });\nconsole.log(result2); // { _id: ..., name: 'John', email: 'john@example.com' }\n","lang":"typescript","description":"Shows how to apply the fields middleware to a Monk collection and use field filtering in queries.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}