Hi,
I have a schema liket this in a ‘portal’ collection
{
enterprise: {
name: 'Company',
street: 'foo',
iban: '123456789',
bic: '123456789'
},
salt: 'mskfjlzjrjzjreofskfns',
hashPassword: 'pjsdfknsfjiejgfqkùgjlr',
}
To detect change on iban or bic field. I use this pipeline
const pipeline = [
{
$match: {
operationType: 'update',
$or: [
{ 'updateDescription.updatedFields.enterprise.bic': { $exists: true } },
{ 'updateDescription.updatedFields.enterprise.iban': { $exists: true } },
],
},
},
];
But it’s don’t work
I have test different strategy, but with no success:
const pipeline = [
{
$match: {
operationType: 'update',
$or: [
{ "updateDescription.updatedFields.enterprise.iban": { $exists: true } },
{ "updateDescription.updatedFields.'enterprise.iban'": { $exists: true } },
{ "updateDescription.updatedFields['enterprise.iban']": { $exists: true } },
{ "updateDescription.updatedFields.['enterprise.iban']": { $exists: true } },
],
},
},
];
If i test the same thing on a field with no dot notation it’s work
const pipeline = [
{
$match: {
operationType: 'update',
$or: [
{ 'updateDescription.updatedFields.salt': { $exists: true } },
{ 'updateDescription.updatedFields.hashPassword': { $exists: true } },
],
},
},
];
How to write or working pipeline on fields with dot notation ?
Thank in advance for your help