hello
I have some custom code that needs to fetch a random row from a collection.
I do as follows: first I count all rowsfrom the table
int numeroMatrici = MS.adminStorageService.findAllDocumentsCount(MS.DB_NAME, MS.MATRIX0_COLLECTION_NAME).getTotalRecords()-3;
then I roll a random index and extract the single row with thata index
int tmp = (int)(Math.random()*numeroMatrici);
sfide0 = MS.adminStorageService.findDocumentsByQueryWithPaging(MS.DB_NAME,MS.MATRIX0_COLLECTION_NAME, QueryBuilder.build("extracted", 0, Operator.EQUALS), 1, tmp ).getJsonDocList();
it worked until yesterday, when I had 1791 rows in the collection
then I added new data to it, for a total of 18950 rows.
now, if the extracted index is greater than 5636 it returns the following exception:
com.shephertz.app42.paas.sdk.java.App42Exception: {"app42Fault":{"httpErrorCode":500,"appErrorCode":1500,"message":"Internal Server Error","details":"Internal Server Error. Please try again"}}
at com.shephertz.app42.paas.sdk.java.connection.RESTConnectorAsync.handleException(RESTConnectorAsync.java:318)
at com.shephertz.app42.paas.sdk.java.connection.RESTConnectorAsync.executeGet(RESTConnectorAsync.java:96)
at com.shephertz.app42.paas.sdk.java.storage.StorageService.findDocumentsByQueryWithPaging(StorageService.java:871)
at com.shephertz.app42.paas.customcode.numbersservice.NumbersService.sendChallenge(NumbersService.java:1002)
at com.shephertz.app42.paas.customcode.numbersservice.NumbersService.action(NumbersService.java:110)
at com.shephertz.app42.paas.customcode.shared.MS.WrapExecute(MS.java:106)
at com.shephertz.app42.paas.customcode.numbersservice.NumbersService.execute(NumbersService.java:59)
at com.mixelweb.customcode.tester.shared.CustomCodeTester.ExecuteLocalLoginService(CustomCodeTester.java:23)
at com.mixelweb.customcode.tester.numbersservice.TestNumbersService.main(TestNumbersService.java:118)
note: all rows in the collection have the "extracted" field set to 0, I checked by exporting the CSV from the web panel