Need help regarding creating accounts for each person | Sololearn: Learn to code for FREE!

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

10/1/2021 6:37:26 PM

Dulya Perera

2 Answers

New Answer

+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) 😊

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