Mongodb references

Asked

Viewed 342 times

3

I intend to make a website. Will have two Collections "sleeve stripes", where it will bear the name of several sleeves. "genero", where will have the generos type "Action,"

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

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

Insert "gender"

db.genero.insert({genero:"Comedia"})
db.genero.insert({genero:"Ação"})

Insert name in "listmangas"

db.listmangas.insert({nome:"toriko"})

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

How to search after the Toriko name of the listmangas and the genus appears:"Action"?

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

1 answer

2


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

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

On the second part of the question, there is a good one example how to query.

  • perfect, I spent hours thinking about how to do this. Thank you so much,

  • Now this Braian, good luck!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.