Hello
I am developing an application for WinRT using the App42 SDK and I am trying to retrieve JSON documents using the StorageService FindDocumentByQuery() function but I keep getting an OutOfMemoryException whenever I call it. This only happens when I am passing in a compound Query which searches for 8+ documents which match 8+ different users OR'd together. So basically I am sending the query to find any documents with username = "user1" OR username = "user2" .... OR username = "user8". If I only search for 7 or less JSON documents then it works fine and I get no exceptions. Here is the relavant code that I am using:
List<Query> queries = new List<Query>();
Query mainQuery;
foreach (User user in this.UsersList)
{
queries.Add(QueryBuilder.Build("username", user.username, Operator.EQUALS));
}
// Combine all the queries into one large query by OR'ing all the individual ones
if (queries.Count > 1)
{
// I start the process outside the loop combining the first 2 to create the first main query object
// that we will combine all the other queries into
mainQuery = QueryBuilder.CompoundOperator(queries[0], Operator.OR, queries[1]);
for (int i = 2; i < queries.Count; i++)
{
mainQuery = QueryBuilder.CompoundOperator(mainQuery, Operator.OR, queries[i]);
}
}
// if there is only one user in the list then we only have 1 query
else
{
mainQuery = queries[0];
}
storageService.FindDocumentByQuery(dbName, collectionName, mainQuery , new App42Callback());
Each document returned is about 300 characters long as a JSON string and the exception text is:
"An unhandled exception of type 'System.OutOfMemoryException' occurred in System.Net.ni.DLL
Additional information: Insufficient memory to continue the execution of the program."
Can you please help me with this?