I have one million XML documents like this in my MarkLogic staging database.
<Details>
<Name>AA</Name>
<EmpId>123</EmpId>
<Account>
<AccountNo>111</AccountNo>
<IFSC>ABC</IFSC>
</Account>
<Account>
<AccountNo>222</AccountNo>
<IFSC>DEF</IFSC>
</Account>
</Details>
In this XML, an employee has multiple account numbers. From this, I want to identify any of the employees that have the same account number. Finding out unique account number from all 1M documents, and then check if the account number is matching to multiple employee ids.
How do I achieve this?