Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Getting Error when trying to go to next 50 results for Aggregate #1529
I am running the following Aggregate that was provided to me by a developer. I get the first 50 documents but when I try to go to the next 50 I get the following error:
Error: Line 1: Unexpected token .
I am running this in Robo 3T 1.2.1 against a Replica Set connection on MongoDB 3.6.3.
The aggregate is as follows:
Your help would be greatly appreciated
I have run into the same problem.
I am running Robo 3T 1.2.1, against a MongoDB server running v3.4.14
The problem seems to happen if the aggregation includes a $match on a dotted field, for example:
In every case, the same error message is returned when fetching the next 50 rows from the result set:
By contrast, if the $match is on a non-dotted field, there is no error.
I am getting this as well, any feedback on a fix?
This is my aggregation query:
To resolve this, I found this issue that gives me a solution: #1058
So, I wrap the above query in a cursor and loop through it as follows:
At least using this approach I can get my data in a single page (I think this is limited to 10000 records or something, though, which is fine in my case).
I was getting the error even when i did not have any "dot" in match. Just guessed that it may also be because of $sort having a "dot". just did a workaround by having an extra field using $addFields
My query (Getting error)
Not sure if the best way to do it but counters the error for say.
4 similar comments
Kinda fixed. The error is suppressed. You are able to paginate. But you are not able to query more than 50 documents. If you define 0 - 100 for example, only the first 50 are returned.
referenced this issue
Apr 3, 2019
Hi @dholbrook86, thanks a lot for your input. It seems that fix for aggregation queries with dotted fields, broke the existing working functionality, now the problem is "batch size is not working properly with aggregation queries.". However, batch size does work when it is 50.
I have already created a ticket to be fixed in 1.4.
To prevent this kind of fixed-one-broke-other problems in the future, we will add more tests related to aggregation.