Page 1 of 1

how to retrieve specific user's data from database to their device?

Posted: Thu Jan 15, 2015 3:24 pm
by AC

hello, me again. :)

I read the tutorial and followed a very useful blog to use appery. Now I made a page of user regiteration/login information. I have another page that I can successfully list all information from the database collection.

All users upload their data to this collection, how can i make sure they can only get his own uploaded data other than all data from the collection when he use the database list service?

please give me some detailed hints or tutorials. i am very new in programming.

thx!!!


how to retrieve specific user's data from database to their device?

Posted: Thu Jan 15, 2015 6:00 pm
by AC

any staff here can offer me a clue?


how to retrieve specific user's data from database to their device?

Posted: Fri Jan 16, 2015 5:42 am
by Yurii Orishchuk

Hi AC,

You can add "user" field to your goal collection and then filter all items with following way.

  1. Add query service onto your page.

  2. Open "before send" mapping.

  3. Click on "where" request parameter "JS".

  4. Use following JS code:

    pre

    var userId = "5400c608e4b051d053e3d986";
    var whereObject = {
    user: {"$inQuery": {_id: userId } }
    };

    return JSON.stringify(whereObject);

    /pre

    Regards.


how to retrieve specific user's data from database to their device?

Posted: Fri Jan 16, 2015 6:42 am
by AC

thx a lot Yurii, can u also help me to check this question as well? I used ur code from previous post but cant get it work. https://getsatisfaction.com/apperyio/...