Hello, I am using Azure Cosmos DB MongoDB shell, and when I perform the QUERY, I receive the error: The SQL query text exceeded the maximum limit of 544720 characters in Azure CosmosDB.
My query is the following:
db.Actions.aggregate([{$match:{type:{$in:["registration","fillform"]}}},{$lookup:{from:"Visits",localField:"value",foreignField:"token",as:"Visit"}},{$unwind:"$Visit"},{$match:{"Visit.url":{$regex:/path=testtest/}}},{$group:{_id:{Date:{$dateToString:{format:"%Y-%m-%d",date:"$date"}},ActionType:"$type"},Count:{$sum:1}}},{$project:{_id:0,Date:"$_id.Date",ActionType:"$_id.ActionType",Count:1}}])
the source C# code via mongo driver the following:
var actions = await _dbContext.Actions
.Aggregate()
.Match(actionsFilter)
.Lookup<Action, Visit, ActionLookedUp>(_dbContext.Visits,
(Action output) => output.Value,
(Visit visit) => visit.Token,
(ActionLookedUp output) => output.Visits)
.Unwind<ActionLookedUp>("Visits")
.Match(visitsFilter)
.Group(GetGroupByExpression(filter.GroupBy), g => new { g.Key, g.Key.Type, Count = g.Count() }).ToListAsync();
the response is also can not be more than 10 or even 50mb, because as you can see i use Group
As you can see this query is not too long (just filter, lookup, and group and that’s it) I need to receive groups with count, but I receive the Error. How can I fix it?
I did not find any answer on this issue in the internet (only something like "write to support")
Please help, how can i perform the query and receive the data?
Thanks!