I need to verify that for each document it has the same value for the baz field.
The structure looks like this.
{
_id : 111111,
foo : 123123,
bar : [
{
subId : 121212,
baz : abc123
},
{
subId : 131313,
baz : abc123
},
]
},
{
_id : 222222,
foo : 234234,
bar : [
{
subId : 212121,
baz : def456
},
{
subId : 313131,
baz : def456
},
]
},
Basically I just need to make sure that for each document, baz should be always the same. How can I query it?
bazfield as a root level field?