Page 1 of 2

Joining Database Collections

Posted: Tue Dec 17, 2013 11:28 pm
by Tyler

How do you join Database tables (collections)? For example, I want a user to have a task. I want the ability of a user to see one other user's tasks (but not everyone). I need to design a UI to have one user select who they join to.

I know how to do this in say MySQl or Oracle with a sql join, but I want to use appery.io and the databse here. Please help


Joining Database Collections

Posted: Tue Dec 17, 2013 11:58 pm
by Igor

Hello,

You could use "ACL" to restrict access to the collection fields.
http://docs.appery.io/documentation/b...


Joining Database Collections

Posted: Thu Dec 19, 2013 4:31 am
by Tyler

I have read that documentation before but don't understand how that relates to what I would like to do.

Let me try to give an example (this is not what I am doing exactly, but the premise is the same).
I have a "collection" of Employees. I have another "collection" of Dependents. I want to link Dependents to an employee.

In most RDBMS I could do something like a foreign key per dependent row that is an emp_ID or something like that. This could be one way to join these two collections in most RDBs.

How would you do such a thing with this tool? If it is with ACL, can you please give me greater detail as to how?


Joining Database Collections

Posted: Thu Dec 19, 2013 4:49 am
by Illya Stepanov

Hi Tyler,

Appery.io DataBase service is based on MongoDB, you can read more about it here - http://www.mongodb.org/

MongoDB is not a relational DataBase, I hope this doc should be helpful :: http://docs.mongodb.org/manual/refere...


Joining Database Collections

Posted: Thu Dec 19, 2013 6:18 pm
by Tyler

Neither of you have really helped me much... let me try again. If Appery.io Database is based on MongoDB, and MongoDB says the equivalent of table joins is "embedded documents and linking". How do I use embedded documents and linking in Appery.io?


Joining Database Collections

Posted: Thu Dec 19, 2013 6:37 pm
by Kateryna Grynko

Hi Tyler,

Sorry for the misunderstanding. To add links you would need to add a column with type=pointer: http://docs.appery.io/documentation/b...


Joining Database Collections

Posted: Fri Dec 20, 2013 4:50 am
by Tyler

Thank you Katya!! I greatly appreciate the help! The pointer type is what I missed and I think is exactly what I needed. Thank you!


Joining Database Collections

Posted: Sat Dec 21, 2013 2:44 pm
by Bad Addy

Tyler, could you explain more, if you have managed to join the collections, what the pointer is, and how it works. The docs are not helpful at all.

And I am looking to link collection (A) with collection (B). Based on two values. Is this what you have been looking at doing ?


Joining Database Collections

Posted: Mon Dec 23, 2013 8:09 am
by Kateryna Grynko

Hi,

Pointer stores a pointer to an object based on its ID and collection name, so you can't base it on particular fields of another column. It can be set based on ID and collection name only.


Joining Database Collections

Posted: Fri Feb 06, 2015 12:23 pm
by anshika

Hi kateryana ,

using pointer we can establish many to one relationship
how to establish a reverse relational that is one to many or many to many:

for example i have two tables A and B
in Table B i am having a pointer column of Table A and hence will have all the records of table A in B.
how to fetch all the records from table A and B (one to many) and display it on the screen