findAlldocument has any limiation

0 votes

Dear all,

I am new on App42.  For POC, I move my Parse.com data to App42. 

Now my data is in storage and i easy get my document by using findAllDocuments. 

I my mobile app i am searching all documents and get a value of key and fill a Spinner (dropdown) in my mobile app.

 

Here is my code. I can not get all the documents :( Is the servıce has any limitation ?

 

 StorageService storageService = App42API.buildStorageService();
        HashMap<String, String> otherMetaHeaders = new HashMap<String, String>();
        otherMetaHeaders.put("orderByAscending", "Brand");
        String dbName = "mydb";
        String collectionName = "CarBrand";
        storageService.setOtherMetaHeaders(otherMetaHeaders);
        App42CacheManager.setPolicy(App42CacheManager.Policy.CACHE_FIRST);
        App42CacheManager.setExpiryInMinutes(3600); //1 hour

        storageService.findAllDocuments(dbName, collectionName, new App42CallBack() {
            public void onSuccess(Object response) {
                Storage storage = (Storage) response;
                ArrayList<Storage.JSONDocument> jsonDocList = storage.getJsonDocList();

                ArrayList<String> brandlist = new ArrayList<>();
                final ArrayAdapter adapter = new ArrayAdapter(
                        getActivity().getApplicationContext(), R.layout.spinner_lay, brandlist );

                for (int i = 0; i < jsonDocList.size(); i++) {
                    try {
                        JSONObject jsonObject = new JSONObject(jsonDocList.get(i).getJsonDoc());
                        System.out.println("API42 BRAND " + jsonObject.getString("Brand"));
                        brandlist.add(jsonObject.getString("Brand"));
                    } catch (JSONException e) {
                        e.printStackTrace();
                        System.out.println("Exception felan creating name" + e.getMessage());
                    }
                }

                try {
                    getActivity().runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            // TODO Auto-generated method stub
                            markalar.setAdapter(adapter);
                        }
                    });
                } catch (Exception ex) {
                    System.out.println("Exception while creating array" + ex.getMessage());
                }
            }

            public void onException(Exception ex) {
                System.out.println("Exception Message" + ex.getMessage());
            }
        });

 

asked Mar 5, 2016 in Android by admin (10 points)

1 Answer

0 votes

Hi, 

Yes, there is a limitation on no of documents fetch in single API call and i.e is 100. So if you want to fetch records above 100, then use paging method to find all those records. Please have a look at this link and let us know if it helps. 
 
P.S Max 100 records are allowed to find documents from App42 database in all methods. 
 
Regards,
Himanshu Sharma
answered Mar 5, 2016 by hs00105 (2,005 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...