+ 1

Need help regarding creating accounts for each person

I'm developing a mobile application using react native, express.js and mongodb. The app is doing blog posting(create new blog post) and viewing created blogs by logged person. Once the user login to app user should be able to view all blogs created by that person. If I create the mongodb collections as a user for user login details and blogs for all user created blogs details, how can I show the blogs for particular person in app once they logged in.

1st Oct 2021, 6:37 PM
Dulya Perera
Dulya Perera - avatar
2 Respuestas
+ 1
There must be a method fetchall on db. Use it to get document from user table based on username or their email or whatever entry you have in document user. Then from the received data get a attribute that is in blogs table as well. After you use that attribute to fetch blogs from blogs table. I am not sure if above will work but you can try or atleast it gave you an idea on what to do (rest google is your friend) 😊
1st Oct 2021, 6:56 PM
Abhay
Abhay - avatar
+ 2
Wow..!! It's a great idea Abhay... By making a relationship between blogs and user is a good idea. When creating a new blog I've to pass the id of user and when retrieving blogs I must do search by user ID.
2nd Oct 2021, 5:31 PM
Dulya Perera
Dulya Perera - avatar