Tyler
Posts: 0
Joined: Tue Dec 17, 2013 11:28 pm

Joining Database Collections

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

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Joining Database Collections

Hello,

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

Tyler
Posts: 0
Joined: Tue Dec 17, 2013 11:28 pm

Joining Database Collections

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?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Joining Database Collections

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...

Tyler
Posts: 0
Joined: Tue Dec 17, 2013 11:28 pm

Joining Database Collections

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?

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

Joining Database Collections

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...

Tyler
Posts: 0
Joined: Tue Dec 17, 2013 11:28 pm

Joining Database Collections

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!

Bad Addy
Posts: 0
Joined: Fri Dec 13, 2013 9:34 pm

Joining Database Collections

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 ?

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

Joining Database Collections

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.

anshika
Posts: 0
Joined: Fri Feb 06, 2015 11:59 am

Joining Database Collections

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

Return to “Issues”