Hi there,
Here is a document from my collection.
{
optionId: ‘18270562735’,
sizes: [
{ sku: ‘1827056273534’ },
{ sku: ‘1827056273536’ },
{ sku: ‘1827056273538’ },
{ sku: ‘1827056273540’ },
{ sku: ‘1827056273542’ },
{ sku: ‘1827056273544’ },
{ sku: ‘1827056273546’ },
{ sku: ‘1827056273548’ },
{ sku: ‘1126083251150’ },
{ sku: ‘1126083251152’ }
]
}
I’d like to find all documents where the substring of sku (length 11) in the “sizes” array is not equal to “optionId” value.
I succed with aggregate() operation.
Is there any way to do so with a find() operation ?
Such a query is wrong
find({‘sizes.sku’:{$regex:/’$optionId.*’/}})