I have a document like
Doc1 - {
'category' : [c1,c2]
'location': [l1,l2]
}
Doc2 - {
'category' : [c1]
'location': [l1]
}
Doc2 array elements are subelements of Doc1 array.
Can I use mongo aggregation query to mark them as duplicate or should i use full text search on each array by unwinding them ?
I am open to changing the structure of document instead of array if it can meet my business requirement.
I need to restrict use from entering document with similar array inputs like above.
Business reason - User will provide one of the array value for each array key, and during evaluation, the system should have only one document matching or none.