Closed Skullw1ng closed 3 years ago
Care to share more code? It says here to split up the code. If you're using JSON([]) to create a query document for every call I would consider keeping a copy of the JSON document and filling in the values that change with every call. (Pay attention to multi-thread issues if you're calling from multiple threads...)
I took the json file and added in the values that I needed string by string in json, then parsed it into the IJSONDocument. Works fine.
For those who might have a similar problem:
var document : IJSONDocument;
document.parse('{"_id":"ObjectID(\"'+JSONMongoObjectID(mongoObjectID)+'\")",'
+'"Test": "Hi",'
+'"Test1": "Cool"}');'
function JSONMongoObjectID(input:string):string;
begin
Result := StringReplace(input,'ObjectId("','',[rfIgnoreCase,rfReplaceAll]);
Result := StringReplace(Result,'")','',[rfIgnoreCase,rfReplaceAll]);
end;
Please replace the document.Parse
call with this code. It is very important not to work with 'JSON in string form' unless you really absolutely have to.
document['_id']:=mongoObjectID;
document['Test']:='Hi';
document['Test1']:='Cool';
Hello!
Today I got the error "E2156 Expression too complex", does anyone know what I can do about this? I guess splitting the data inside JSON([]) up would be possible but I would like to keep it as a single entry.
Thanks, Etienne