androidbackendlessmbaas

BackEndless Data Managemet for Multiple Users


I'm using backendless.com as my backend service. My application has a data class (DataManager), which contains one String called chore. The first user (User A) checks off the chore that they did and it's saved to the Backendless service. An App Table is created on the Backendless website called DataManager and the checked off chore is found there.

That work's fine for one user.

When a 2nd user registers (User B), they check off their chores. Now that data is saved in the same AppTable on the website (DataManager).

My main question is, is this typical to have one Table for all of your users and their data?

Secondly, if I want to retrieve the data for User A only, how can I do that?

I know that I can create a user ID column in the Table but let's say that I have 1000 users and need user A's info only. Then would my app need to query all 1000 users and just pull out the info for user A? Doesn't that seem like too much work for the app to be doing? Does anyone know a better way to handle this? Thank you.


Solution

  • You can use BackendlessDataQuery object to make query (like give me all users called 'Alex', or give me all Cars with color = 'blue').

    Backendless.Persistence.of( E ).find( BackendlessDataQuery query,
    AsyncCallback<BackendlessCollection<E>>
    );
    

    If you wanna know more, download de PDF api from Backendless.com, page 75 (examples and more information are there).

    On thing I like Backendless is because the API is very helpfull, at least in Android..

    Edit: It's better to have 1 table with 1000 users than 1000 tables with 1 user.. Much better ;)