[SERVER-27649] Don't error on serialization of $elemMatch with $regex Created: 12/Jan/17  Updated: 05/Jan/18  Resolved: 19/Jan/17

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: 3.4.1
Fix Version/s: 3.4.2, 3.5.2

Type: Bug Priority: Critical - P2
Reporter: Claudio Petrini Assignee: James Wahlin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File backtrace.txt    
Issue Links:
Backports
Duplicate
is duplicated by SERVER-4645 The shell's db.collection.find() comm... Closed
Related
is related to SERVER-12600 Failure to parse $regex $option 'x' i... Closed
is related to SERVER-22833 MatchExpression::toBSON does not nece... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.4
Steps To Reproduce:

On Mongo v3.4.1 execute the following query:

{
    fieldA: 'valueA',
    fieldB: 'valueB',
    sub_categories: {
        '$elemMatch': {
            '$regex': '^abc$' 
        }
    }
}

The collection queried has indexes as described in the description, the error happens only when sorting with this value {_id : 1}

Sprint: Query 2017-01-23
Participants:
Case:

 Description   

Hi,
after the upgrade to Mongo 3.4.1 we're having this error "Error: assertion src/mongo/bson/bsonelement.cpp:449" caused from the query described in the Steps to Reproduce the error.

The collection on which the query is executed has the following indexes :

  1. _id: the default index
  2. (fieldA, fieldB) : a compound index

This error happens only when the sort query parameter is configured to {_id : 1}.



 Comments   
Comment by Githook User [ 19/Jan/17 ]

Author:

{u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'}

Message: SERVER-27649 $elemMatch serialization $regex support

(cherry picked from commit 04b16905b7c3b6b3fce5fbc7f6ba17522311a7c4)
Branch: v3.4
https://github.com/mongodb/mongo/commit/8a5f459539b651cccefc35ebe209e30af2b1b9f1

Comment by Githook User [ 19/Jan/17 ]

Author:

{u'username': u'jameswahlin', u'name': u'James Wahlin', u'email': u'james.wahlin@10gen.com'}

Message: SERVER-27649 $elemMatch serialization $regex support
Branch: master
https://github.com/mongodb/mongo/commit/04b16905b7c3b6b3fce5fbc7f6ba17522311a7c4

Comment by James Wahlin [ 17/Jan/17 ]

The currently planned fix for this issue may address SERVER-12600. Will confirm prior to resolving.

Comment by David Storch [ 12/Jan/17 ]

Hi claudio.petrini@stamplay.com,

Thanks for the detailed bug report. I can reproduce this assertion failure as follows:

db.c.drop();
db.c.find({a: {$elemMatch: {$regex: "abc"}}}).explain();

This looks like an issue with the MatchExpression serialization improvements made for 3.4 under SERVER-22833. Please continue to watch for updates.

Best,
Dave

Generated at Thu Feb 08 04:15:46 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.