[SERVER-6470] aggregation converts regex values to strings in result set Created: 16/Jul/12  Updated: 28/Oct/15  Resolved: 11/Dec/12

Status: Closed
Project: Core Server
Component/s: Aggregation Framework
Affects Version/s: None
Fix Version/s: 2.3.2

Type: Bug Priority: Major - P3
Reporter: Aaron Staple Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Minor Change
Operating System: ALL
Participants:

 Description   

Observed behavior: An aggregation result based on a regular expression from mongod is converted to a string in the result set.
Expected behavior: The aggregation result is returned as a regular expression type.

Test:

> c.save( { a:/x/i } )
> c.find()
{ "_id" : ObjectId("5004823ca08131138fd399d6"), "a" : /x/i }
> c.aggregate( { $project:{ b:'$a' } } )
{
	"result" : [
		{
			"_id" : ObjectId("5004823ca08131138fd399d6"),
			"b" : "x"
		}
	],
	"ok" : 1
}



 Comments   
Comment by Githook User [ 11/Dec/13 ]

Author:

{u'username': u'estolfo', u'name': u'Emily Stolfo', u'email': u'emily@10gen.com'}

Message: RUBY-698 Only test regexes with aggregation if version > 2.3.2. SERVER-6470
Branch: 1.x-stable
https://github.com/mongodb/mongo-ruby-driver/commit/ebfd6ce57033149dd4e511e64d73e5a0f7c386a2

Comment by Mathias Stearn [ 11/Dec/12 ]

Backward breaking only in unlikely case of users depending on broken /a/i == "a" behavior.

Comment by auto [ 11/Dec/12 ]

Author:

{u'date': u'2012-11-29T19:54:48Z', u'email': u'mathias@10gen.com', u'name': u'Mathias Stearn'}

Message: Add at least minimal support for all types to agg

Minimal support means conversion to/from BSON, comparison and hashing.
This means that they can be passed through the pipeline correctly, used
in $sort, and used in _id expressions in $group.

SERVER-4608 - Binary pass through
SERVER-5718 - Code/CodeWScope pass through
SERVER-6470 - Don't convert Regex to String
SERVER-7185 - Symbol support
Branch: master
https://github.com/mongodb/mongo/commit/fefb4334afe40664438668a289c6daed6813b3c3

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