I have a collection "testcase" like this, Test Builds have many Test Case Logs and Test Case Logs have many tags. For example I have a query where tags should have "tag1".
db.test_builds.find({"logs.tags" : "tag1"})
The problem is that it gets all the test case logs of the test builds. But I only wanted test case logs where the "tag1" exists.
For example:
{
"name" : "TestBuild1"
"logs: [
{"name" : "Log1"
"tags" : ["tag1","tag2"]},
{"name" : "Log2"
"tags" : ["tag3","tag4"]}
]
}
The query above returns the whole test build, but I only want to get Test Build with "Log1", but not "Log2". How is this possible?