I want user to update their profile with additional information.
I just want to map the user to the specified collection.
Is there a way in MGO (or any other driver) to set relationship/foreign key for the table ?
thank you !
Sample existing application:
user name
password
I want to add Address, Contact Number, Age, ■■■, DOB details to the current user.
How can I achieve this using MGO or any other driver that could help achieve this ?
Have achieved the same using Ruby on Rails with Mongo as a DB but could not get this done using Go Language.
Kindly suggest , thank you 
CurtGreen
(Curtis Allyn Green)
2
MongoDB being NoSQL is a little different than the SQL method in how you can accomplish this: https://medium.com/@dis_is_patrick/mongodb-relations-26201385b919
Couple of choices there, references or embedding. But if you want to know more about references in mongo using mgo you’ll need the DBRef type: https://github.com/go-mgo/mgo/blob/v2/session.go#L3295
Here are the mongo docs pages on the subject of references: https://docs.mongodb.com/manual/reference/database-references/
1 Like
thank you so much @CurtGreen 
Now I am slightly clear about setting the reference. Will try those 
Thanks again !
system
(system)
Closed
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.