[SERVER-4184] date max index bound value looks messed up in shell as IsoDate Created: 31/Oct/11  Updated: 14/Apr/16  Resolved: 29/Feb/16

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

Type: Bug Priority: Minor - P4
Reporter: Aaron Staple Assignee: DO NOT USE - Backlog - Platform Team
Resolution: Won't Fix Votes: 0
Labels: confirm
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-4180 Allow multiple constraints (on same f... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Participants:

 Description   

> c.find({a:{$gt:new Date()}} ).explain()
{
"cursor" : "BtreeCursor a_1",
"nscanned" : 0,
"nscannedObjects" : 0,
"n" : 0,
"millis" : 0,
"nYields" : 0,
"nChunkSkips" : 0,
"isMultiKey" : false,
"indexOnly" : false,
"indexBounds" :

{ "a" : [ [ ISODate("2011-10-31T20:13:32.168Z"), ISODate("292278995-01--2147483647T07:12:56.808Z") ] ] }

}

> c.find({a:{$gt:new Date()}} ).explain().indexBounds.a[0][1].valueOf()
9223372036854776000

I think this value is generated by

void BSONObjBuilder::appendMaxForType( const StringData& fieldName , int t ) {
....
....
case Date:
appendDate( fieldName , numeric_limits<long long>::max() ); return;

Potentially this numeric value is invalid for a javascript date, but we might want to do something so the output looks a little nicer.

Also, there could potentially be other issues relating to date values outside an allowed js date range (round tripping, $where style queries, etc). So might be worth spending some time looking into these.


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