Hi
Could you please post more information about your issue:
I know that my aggregation stopped working because this message that I receive in Slack tells me how many documents were found by that query.
My understanding is your end point continues to send a message to Slack every 15 minutes but the count of documents returned by your aggregation query is 0 after 4-5 hours. Is this correct?
I also log this aggregation’s result to a separate collection, so the connection with my DB is not a problem.
How are you logging the result into a separate collection? Are you using the $out operator?
I can copy this same aggregation command (with the Express app still running) and put it into Robo 3T/Mongo Shell, execute it and STILL get results out of it.
Please post the aggregation query in question, along with some example documents. How long does the aggregation usually run for? Does it take more than 15 minutes at some times?
As soon as I restart my express application this aggregation will find all the data that has been “stuck” since the past few hours
Please post a small example of the endpoint code. It would be very helpful if other people can reproduce the issue you’re seeing.
Could you also post the node driver version you’re using?
Are you seeing the same issue using a local deployment as well, or is it only when you’re connecting to Atlas?
Best regards
Kevin
My understanding is your end point continues to send a message to Slack every 15 minutes but the count of documents returned by your aggregation query is 0 after 4-5 hours. Is this correct?
How are you logging the result into a separate collection? Are you using the $out operator?Please post the aggregation query in question, along with some example documents. How long does the aggregation usually run for? Does it take more than 15 minutes at some times?
Please post a small example of the endpoint code. It would be very helpful if other people can reproduce the issue you’re seeing.
app.post('/route', async (req, res) => { const results = await collection.aggregate(<pipeline>).toArray(); <my business logic that uses the "results" object> });Hi Rodolfo
Apologies for the delay in getting back to you, but nothing seems to jump at me. However, the fact that it seems to freeze after a certain amount of time while a manually run query would return something seems to suggest that there is unlikely that anything is wrong with the query.
If you’re still having this issue and would like to dig deeper, I would suggest to try:
Best regards
Kevin
app.post(‘/route’, async (req, res) => { const results = await collection.aggregate().toArray(); });
Hi Rodolfo,
Do you wrap the await aggregation in a try/catch ?
Just in case there’s any error with your code before the return of the endpoint response.
Also do you verify whether session always has a value ?
Do you check whether the conditional $filter for session (dynamic periodic date range) always return a value ?
had a chat with MongoDB through the phone and all they did was push me an enterprise plan so I could get “enterprise-grade” support.
I would think that is a reasonable approach, as you said that you can’t disclose some of the proprietary code and environment. Signing an official support contract would allow MongoDB support to look further into your use case with some sort of NDA in place.
Best regards,
Wan.
Do you wrap the await aggregation in a try/catch ?
Just in case there’s any error with your code before the return of the endpoint response.
Also do you verify whethersessionalways has a value ?
Do you check whether the conditional$filterfor session (dynamic periodic date range) always return a value ?
Every time I had to explain it to someone the outcome is always the same - doubtful or skeptical questions. And I get it, it sounds like either I’m lying or just a beginner in this ecosystem. I’d react the same way if someone told me such an issue exists.
Hi Rodolfo,
This problem doesn’t appear to be trivially reproducible and without further details it’s likely there won’t be any progress. It would be great if you could provide a minimal, complete, and reproducible code example.
If this is a bug with MongoDB Node.JS driver, it would be preferable if a bug report could come out from this discussion and fix it for others too.
In our case that happens with finds :(
Miquel,
To help focus on the details of your issue, please start a new discussion with relevant details including:
Regards,
Wan.
Hi Miquel,
Could you please start a new discussion thread (new post) to avoid mixing with Rodolfo question about aggregation.
I’ve tried your setup briefly, but as mentioned previously this is not trivial to reproduce.
In the new discussion post, please provide a minimal and complete code that would be able to test the issue.
Regards,
Wan.