Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReactiveAggregate() + collection.update() -> Error: Expected to find a document to change #53

Open
anarchist912 opened this issue Jun 9, 2019 · 1 comment
Labels

Comments

@anarchist912
Copy link

I'm not sure if I'm doing something wrong or this is a bug. I've taken quite an effort to describe the problem on StackOverflow, so please allow me to simply link to my question there.

In short and for search engines:

Uncaught Error: Expected to find a document to change
    at Object.update (collection.js:207)
    at Object.store.<computed> [as update] (livedata_connection.js:310)
    ...

This (probably) gets thrown when ReactiveAggregate() tries to update the clientCollection. But I don't know what I'm doing wrong here.

@anarchist912
Copy link
Author

anarchist912 commented Jun 10, 2019

I could get rid of the above mentioned error by manually giving an arbitrary string to the _id field. I had _id: 0 in the last aggregation stage before. However, contrary to the docs, simply omitting the _id field did not result in an automatic creation of this field by ReactiveAggregate().

So I did this:

...
},{
        $project: {
            _id: "whatTheFuckIsGoingOnHere", // Calm down, bro!
            rankingList: 1,
            product_keys: "$product_keys.product_keys"
        }
    }
], { clientCollection: "aggregatedProductRanking"})

I'm not sure whether I misunderstood the docs, or this is a bug. So I'm leaving this open for you guys. Thanks for this awesome package. Reactive Aggregations are the sh*t!

@JcBernack JcBernack added the bug label May 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants