[SERVER-15482] $size with non-whole-number parameter shouldn't require full scan Created: 01/Oct/14  Updated: 22/Feb/16  Resolved: 04/Feb/16

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 3.3.2

Type: Improvement Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: Tess Avitabile (Inactive)
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Minor Change
Sprint: Query 10 (02/22/16)
Participants:

 Description   

Consider:

db.collection.find({a: {$size: n}})

If "n" is 1.5 or -2, no documents can match. Yet explain() shows a full scan. The query should be short-circuited and return no documents immediately.



 Comments   
Comment by Tess Avitabile (Inactive) [ 04/Feb/16 ]

The $size operator now errors on negative inputs, non-integral double inputs, and inputs that cannot be expressed as a 32-bit integer. Previously negative inputs and non-integral double inputs would simply return no results, and longs would be truncated to integers.

Comment by Githook User [ 04/Feb/16 ]

Author:

{u'username': u'tessavitabile', u'name': u'Tess Avitabile', u'email': u'tess.avitabile@mongodb.com'}

Message: SERVER-15482 Reject bad inputs to size operator
Branch: master
https://github.com/mongodb/mongo/commit/cbf61cd5f3cd91d6fb3686230973c7af004beea0

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