Hi there,
I tried to update some field of documents but i got error.
My document like this
{
"_id":{
"$oid":"62580fb879933461608b499b"
},
"buCode":"LMFR",
"clientNumber":"10002285",
"audiences":[
{
"audience":{
"audienceId":"44901",
"name":"OFFER_Marketing_Cible_Parcours_SDB_SCORE",
"createdDate":{
"$date":"2022-03-18T08:00:27.000Z"
},
"updatedDate":{
"$date":"2022-04-06T10:13:05.000Z"
},
"maximumNumberOfUseDuringMembership":0,
"membershipDuration":1,
"category":"LOYALTY",
"description":null,
"buCode":"LMFR"
},
"startDate":{
"$date":"2022-04-14T12:12:44.290Z"
},
"remainingNumberOfUse":0,
"lastEntryDate":{
"$date":"2022-04-14T12:12:44.290Z"
}
}
]
}
I want to update the field lastEntryDate and startDate to current date.
i write this query but it’s not working. i don’t know why.
db.customer.updateMany
(
{
"$and":
[
{
"audiences.audience.audienceId":
{
"$eq":"44901"
}
},
{
clientNumber:
{
"$nin":[
"11803","388223",
]
}
}
]
},
{
$set:
{
"audiences.startDate": ISODate(new Date()),
"audiences.lastEntryDate": ISODate(new Date())
}
},
{
multi:true
}
)
The message error is
TypeError: e.match is not a function
Someone can help me
Thanks