I have following structure in documentdb
{
"_id": {
"$oid": "5bc7a1d14cedfd0006445b10"
},
"externalId": {
"$numberLong": "70285"
},
"passengers": [
{
"_id": {
"$numberLong": "3757"
},
"name": "abc",
"email": "abc@xyz.com"
},
{
"_id": {
"$numberLong": "398"
},
"name": "abc n",
"email": "abc@xyz.com"
}
]
}
I was trying to find documents where first two element in array have same email
Now with mongo db the following query works (answered here )
db.collection.find({
$expr: {
$eq: [
{
$arrayElemAt: [
"$passengers.email",
0
]
},
{
$arrayElemAt: [
"$passengers.email",
1
]
}
]
}
})
However this does not work with DocumentDb. The document db engine version is 5.0
Is there an alternative query in documentDb for the same?