findOneAndUpate options arrayFilters cannot use with $or (logical query operations)
See original GitHub issuemongoose version: 5.13.8
mongodb version: 3.6.17
node.js version: 12.13.3
I was using findOneAndUpdate() with arrayFilters in options. It didn’t work with logical query operator, like $or, $and.
{ _id: 'xxxxx' },
{
'$set': {
'identities.$[elem].workingStatus.workingStatus': 'xxx',
'identities.$[elem].workingStatus.workingStatusUpdateTime': 'xxx'
}
},
{
"new": true,
"arrayFilters": [
{
"$and": [
{
"$or": [
{
"elem.workingStatus.workingStatusManualTime": {
"$exists": false
}
},
{
"elem.workingStatus.workingStatusManualTime": {
"$lte": "xxx"
}
}
]
},
{
"elem.deleted": false
}
]
}
]
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:6
Top Results From Across the Web
Unable to use $or in array filters with updateOne - v6.0.5 #10696
Sulaiman90 mentioned this issue on Sep 8, 2021. findOneAndUpate options arrayFilters cannot use with $or (logical query operations) #10686.
Read more >Update with array filter doesn't update anything mongo go driver
I should use : opt := options.FindOneAndUpdate().SetArrayFilters( options.ArrayFilters{ Filters: []interface{}{ bson.M{ "elem.name": bson.
Read more >update — MongoDB Manual
The update methods provided by the MongoDB drivers use this command ... You cannot specify multiple collations for an operation. ... arrayFilters, array....
Read more >Mongoose v6.8.2: API docs
[options.serverSelectionTimeoutMS] «Number» If useUnifiedTopology = true , the MongoDB driver will try to find a server to send any given operation to, ...
Read more >options - Go Packages
Package options defines the optional configurations for the MongoDB Go Driver. ... Specifies a collation to use for string comparisons during the operation....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Sulaiman90 please open a new issue a follow the format.
@IslandRhythms created new issue https://github.com/Automattic/mongoose/issues/10696