This is a sample aggregation stage that insert a field into every document.
Steps:
- Git clone the mongodb source code.
- Create a directory called 'modules' in
src/mongo/db/modules
. - Git clone this repo as
src/mongo/db/modules/inject
- Build MongoDB
- Now try the new aggregation stage: