Querying documents with arrays in MongoDB -


i have document has array property contains ids of documents stored in collection, below:

movie: { title: 'a title', genres: ['id_1', 'id_2', 'id_3', 'id_4' ] }

now want pull related genres 1 query specified movie. possible mongodb driver c# using query.all()?

as mongodb not support joins , there no way drivers of c# going you. (https://groups.google.com/forum/?fromgroups=#!topic/mongodb-user/uuqikhcxp4o) . in case joining on client side , slow. try change document structure , if possible use sub-document of genres make advantage of mongodb. 1 of suggestion can give , if have places show small information genres , id store more information not , while showing movie can pick document , show them , give link in case want more . more on : mongodb , "joins"

     movie: { title: 'a title', genres: [{id : 'id_1' , "name" : "classic"}, {id :'id_2' , "name" : "romantic"} ] } 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -