Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

I need to have new db copy made for every app install

Each time a user downloads and installs my app, I need them to get a new and dedicated database with tables already built and one example row in each table. How do I do this and does Appery host the databases?

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

I need to have new db copy made for every app install

Hello Dave,

There is no possibility to create a personal database for each user. Could you please clarify why don't you want to store data for all users in one ot the collections of database in Appery.io

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

I need to have new db copy made for every app install

Each user of the app needs to maintain a personal list of their own that is not shared with every user of the application.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

I need to have new db copy made for every app install

Hi Dave,

Just add a field 'owner' to a collection where you store user id, and then use a parameter 'where' to obtain the user data: http://devcenter.appery.io/documentat...

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

I need to have new db copy made for every app install

Though this example shows me how to create a user. It doesn't show me anything about the where parameter. Can you provide an example of how and where I would place the 'where' parameter and it's criteria? Thanks.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

I need to have new db copy made for every app install

Hi Dave.

Lets assume: in your collection you have field "owner".

This field fills with user "_id" who created this row in collection.

When you need to get all user(with certain "_id") rows you need to make following:

1 Add to your page "query" service for collection you need. http://prntscr.com/3vu3gc/direct

2 Click "Edit mapping".

3 Navigate to "Request" tab and you will see "Where" request parameter. http://prntscr.com/3vu5hi/direct

4 You can map directly "LSV" to this field. http://prntscr.com/3vu69b/direct

5 Then click "Add JS" and fill it with following code:

pre

var where = {"owner": value};

return JSON.stringify(where);

/pre

http://prntscr.com/3vu9z1/direct

So you need fill this parameter with current user "_id" and this service will return only items with this id.

Regards.

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

I need to have new db copy made for every app install

Do I need to put an 'owner' field (column) in each collection they will be using? I am assuming so. I have two collections they will use.

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

I need to have new db copy made for every app install

Ok, the last step number 5 ... I added the script to the 'Where' request parameter JS Add. ... however, I am still seeing all items on list by both logins. Please help.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

I need to have new db copy made for every app install

Hi Dave,

Please make the following screen shots:

1 Your DB collection.

2 Service request mapping.

3 Service request mapping "where" add js code.

Regards.

Dave Troxel
Posts: 0
Joined: Fri May 09, 2014 1:07 pm

I need to have new db copy made for every app install

You won't be able to see all the columns with screen shots. There are two collections in the Med_DB being used: MedsColl and DocsColl.

I have added the column 'owner' to both but have not built out the mappings for DocsColl as of yet. Only working with MedsColl to get it working.

I will share the app with you for you to review when you can please.

Return to “Issues”