所以,在我的MongoDB我有一个看起来像这样几个文件:如何在MongoDB中排列查询
{
"_id" : ObjectId("56a17b7f5f7ecf32c5ee0077"),
"MediaID" : "302048",
"MediaName" : "El Viejo y el Mar",
"MediaTypeID" : "384",
"MediaTypeName" : "Movie",
"Rating" : NumberInt(0),
"Description" : "La versión cinematográfica de la obra inmortal de Ernest Hemingway, sobre un viejo pescador cubano que logra atrapar un pescado gigantesco que lo arrastra lejos de la orilla.",
"MediaWebLink" : "",
"Duration" : "5160",
"FileID" : "523852",
"like_counter" : NumberInt(0),
"EntryId" : "",
"Tags" : [
{
"Key" : "Clasificacion",
"Value" : "B"
},
{
"Key" : "Genre",
"Value" : "Drama|Clásicas"
},
{
"Key" : "Pais",
"Value" : "Estados Unidos"
},
{
"Key" : "Directors",
"Value" : "John Sturges"
},
{
"Key" : "Actors",
"Value" : "Spencer Tracy"
},
{
"Key" : "Distribuidor",
"Value" : "Warner"
},
{
"Key" : "Subtitles",
"Value" : "Español"
},
{
"Key" : "Audio Version",
"Value" : "Inglés"
},
{
"Key" : "Sub-Genre",
"Value" : ""
},
{
"Key" : "Palabras Clave",
"Value" : ""
},
{
"Key" : "Prizes",
"Value" : ""
}
],
"Metas" : [
{
"Key" : "Nombre original",
"Value" : "The Old Man And The Sea"
},
{
"Key" : "Synopsis corta",
"Value" : "Es la historia de un viejo pescador cubano que logra atrapar un pescado gigantesco que lo arrastra lejos de la orilla."
},
{
"Key" : "Duracion",
"Value" : "01:26:00"
},
{
"Key" : "Ano",
"Value" : "1958"
},
{
"Key" : "Score de titulo",
"Value" : "4"
}
],
"AdvertisingParameters" : [
]
}
里面的文件,有一个名为标签的数组,其中一个关键= Distribuidor和值=华纳 我需要的是做一个查询,在那里我可以获得我拥有的所有文档的所有区别“distribuidor”值。
到目前为止,我已经试过这样:
db.catalogo.distinct('Tags.Value', { 'Tags.Key': 'Distribuidor' })
但这让我所有的值,而不是只为“distribuidor”值。
有什么建议吗?
这正是我所寻找的,非常感谢! –