A Node.js + Mongoose + Jest project that demonstrates how to use MongoDB's $literal
operator to fix some common issues.
This repo was build as an example for my article Fixing MongoDB's error "'$' by itself is not a valid FieldPath".
What you need to run this project:
- Node.js
(MongoDB is not required because it'll run in memory by the package mongodb-memory-server
).
npm install
npm test
Feel free to contribute to this project either by leaving your comments and suggestions in the Issues section or creating a PR.
To learn more about how this project executes tests on a dynamically generated database in memory, check my article Testing Node.js + Mongoose with an in-memory database