How can we use $filter in combination with $expr in find() function

Hi @Satyanarayana_Ettamsetty1 - Welcome to the community :wave:

Based on the above, my interpretation is that you wish to move the contents (or specific element which matches the $filter conditions in the changes array field) to another collection and have these archived using Online Archive - Is this correct? - i.e., You only want the elements filtered archived rather than the updated document.

If the above is somewhat correct I believe you’re only wanting to archive the following then?:

{
        type: 'NEW',
        newValue: '234',
        oldValue: '',
        updatedBy: 'System',
        field: 'releaseKey',
        updatedTimestamp: Long("1674818289272")
}

To better clarify could you provide the following information:

  • What documents you are trying to archive
  • The purpose of the second collection mentioned when you advise “another collection” - Is this the online archive collection?

Regards,
Jason

2 Likes