MongoDB - many-many relationship select row that match a set of values -


i working on solution company , i've problem related mongodb solve. building mapping between products , suppliers. simplified structure of documents following:

product {     "id" : "1",     "name" : "any-product", },  supplier {     "id" : "99",     "name" : "acme",     "products" : [1,....] //list of products suppliers can supply } 

when need place order place least number of suppliers....the best 1 supplier can supply entire order.

that's problem: need select suppliers can supply product in given list.

i'm new mongodb , did various tests not find solution....anyway think solution not simple. consider can change structure of db meet these need. feel free propose different approach. in advance


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -