Mongodb referencia


I want to make a website. There will be two collections "listmangas", which will have the name of several mangas. "genre", where you will have the genres of the type "Action, Comedy"

On the website you will have a form to enter the name of the anime and a checkbox to select the genre.

I wanted to understand how to do this in mongodb and then understand how to do it on the website.

Insert "genre"


Insert name in "listmangas"


How to reference gender:"Action" in name:"toriko" ?

How can I look for the name Toriko on the listmangas afterwards and the genus:"Action" appears?

If it got a little messy, I try to improve this question.


From what I know, a document in mongo assumes a nonrelational model and is defined by a set of key-value pairs. So for this scenario to be possible, you should add at the same time:

db.listmangas.insert({nome:"toriko", genero:"acção "})

Regarding the second part of the question, here is a good example on how to perform the query.

Scroll to Top