Page 1 of 2
Database Pointers
Posted: Thu Mar 21, 2013 7:01 am
by Adam DeBray
I'm working on an app that displays comments. I'm able to query the database to display the list of comments, but one of the fields is a Pointer to the Users Collection. What I want to display is the User's firstname and lastname based on the user id. Is it possible to return the firstname and lastname in one Service Call? In other words can you retrieve information from 2 Collections in one Service Call based on a Pointer field?
If not, then I have to call a different GET Service to get the firstname and lastname based on the user id but at what point would I make this call?
What is the best way to do this?
Database Pointers
Posted: Thu Mar 21, 2013 11:10 am
by Kateryna Grynko
Hi Adam,
If there is a field with type = "Pointer" in your collection, then you can add request parameter "include" which value is a Pointer field name (if there are several fields, separate them by commas).
When receiving data, Rest Service will include data pointed by Pointer field.
Database Pointers
Posted: Thu Apr 04, 2013 2:10 pm
by Dupdroid
Hi,
I have done as you suggested. When I test the service it now shows the included Pointer, but the changes does not reflect when I view my mappings though. "Edit Mappings". What should I do do refresh this?
Kind Regards
Database Pointers
Posted: Thu Apr 04, 2013 2:20 pm
by Dupdroid
I have managed to refresh it by clicking the "automatically create service response" but all my previous mappings are lost. Is this the correct method then to refresh changes to a service response?
Database Pointers
Posted: Thu Apr 04, 2013 3:19 pm
by Maryna Brodina
Hello! Yes, this is how it works - if you recreate response mappings disappears, and you should map parameters to controls again.
Database Pointers
Posted: Thu Apr 04, 2013 3:33 pm
by Dupdroid
Thank you Marina. The only problem is that you also loose all your custom javascript in the process.
Database Pointers
Posted: Thu Apr 04, 2013 4:04 pm
by Maryna Brodina
If I understand you correctly, you had to add one more field to response parameters. You could do that manually without refreshing all response parameter data using "automatically create service response" button. Please take a look here http://docs.tiggzi.com/documentation/...
Database Pointers
Posted: Thu Apr 04, 2013 5:00 pm
by Dupdroid
Hi Marina. I added the request parameter : "include" to get a Pointer field in my response. The changes did not reflect in my response when viewing the "Edit Mappings" section. I then used the "automatically create service response" method which did refresh the response but unfortunately deleted all my mappings including my custom JavaScript.
Database Pointers
Posted: Thu Apr 04, 2013 5:54 pm
by Maryna Brodina
You could add Pointer parameter manually as shown it documentation, but now after you click "automatically create service response" the only one way is to restore missing mapping and JS.
Database Pointers
Posted: Mon Sep 23, 2013 2:43 am
by fender
Hi, does the pointer field need to be populated with the _id from the other collection or does this happen automatically when a record is created? Cheers