Closed
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
When using the example from the docs on $accumulator
I get a weird error $accumulator missing required argument 'init'
even though I clearly define init
.
If the current behavior is a bug, please provide the steps to reproduce.
https://gist.github.com/dimaip/17365161ad6e6615cd50bda4b75ad93c
What is the expected behavior?
It should work as the docs describe
What are the versions of Node.js, Mongoose and MongoDB you are using? Note that "latest" is not a version.
Mongo 4.4, Mongoose 5.10.0, Node 10.18.1
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
vkarpov15 commentedon Aug 28, 2020
Unfortunately, the MongoDB driver doesn't serialize functions by default, which is a problem for
$accumulator
. You have two options currently:serializeFunctions
option:We'll add a fix for this in Mongoose 5.10.2 so Mongoose handles this case automatically 👍
dimaip commentedon Aug 28, 2020
Thanks so much for the response and the fix!