$out stage
According to the mongodb documentation
| $out | Writes the resulting documents of the aggregation pipeline to a collection. To use the $out stage, it must be the last stage in the pipeline. |
|---|
the $out stage is working perfectly and writing new collection, i'm using append function
.append({ $out: "aggr_out" })
to place it in the last stage.
The current behavior
- Saving new collection to the database
- Returning an empty array in the
callbackfunction
Expected behavior
- Return the aggregate result
Versions of Node.js, Mongoose, and MongoDB
- node.js v14.17.3 (LTS)
- mongoose v5.13.13
- mongoDB
- db version v4.0.23
- git version: 07c6611b38d2aacbdb1846b688db70b3273170fb
- build environment:
- distmod: debian92
- distarch: x86_64
- target_arch: x86_64
Code
