0

I am using Parse as database. I would like to ask if there are over 1000 items in the Data_db, where the username is unique.

Code:

    ParseQuery<ParseObject> query = ParseQuery.getQuery("Data_db");                 
    query.whereEqualTo("username", edittext_user.getText().toString());
    query.setLimit(1);

Question:

While I know fetching over 1000 dataset we need to use the .setSkip(1000) function and performing looping, I would like to ask how about querying a specific user? Is it also limited to the first 1000 rows? and if yes, how could such user beyond 1000 could be queried?

Thanks!

1 Answer 1

1

You're going about this the wrong way, your query will be inefficient as you're looking 1 object when those constraints through an entire class, regardless of it being already found. It would be better to use getFirstInBackground(). Something like:

ParseQuery<ParseObject> query = ParseQuery.getQuery("Data_db");                 
query.whereEqualTo("username", edittext_user.getText().toString());
query.getFirstInBackground(...);

A maximum of 1000 objects can be returned to you through a single query, by using getFirstInBackground(), you're searching though the database, hence that limitation is not applied.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks a lot for your advice! I really have not thought about this before...and I know that parse got limit of 1000...what if the user to be searched is located at index 1020 in the table, would the codes in question or your advice still work, or would the query end at user#1000 and return nil? (presently my db does not have such volume of data and hence could not be tested)
No its not like that, the query can RETURN up-to a 1000 objects to you, searching through the database is not limited by this condition. Updated answer
thanks, that means it can query more than 1000 objects (all the items in the db) query would not stop at #1000 and return at max 1000 findings

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.