[SERVER-19747] MinKey/MaxKey not printing as JSON in MozJS Created: 04/Aug/15  Updated: 19/Sep/15  Resolved: 10/Aug/15

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

Type: Bug Priority: Major - P3
Reporter: Kevin Pulo Assignee: Mira Carey
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-19171 Shell does not always use extended JS... Closed
related to SERVER-13209 Ensure extended shell JSON ouput form... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platform 7 08/10/15
Participants:

 Description   

Against master:

> MinKey
[object MinKey]
> MaxKey
[object MaxKey]
> tojson(MinKey)
[object MinKey]
> tojson(MaxKey)
[object MaxKey]

The corresponding historical output (eg. in 3.1.6) is:

> MinKey
{ "$minKey" : 1 }
> MaxKey
{ "$maxKey" : 1 }
> tojson(MinKey)
{ "$minKey" : 1 }
> tojson(MaxKey)
{ "$maxKey" : 1 }

Among other things, leads to strangeness in the output of sh.status():

...
{  "_id" : "test",  "primary" : "shard0000",  "partitioned" : true }
        test.test1
                shard key: { "_id" : 1 }
                chunks:
                        shard0000       1
>>>>>>>>>>      { "_id" : [object MinKey] } -->> { "_id" : [object MaxKey] } on : shard0000 Timestamp(1, 0)
...

Whereas this used to be:

...
{  "_id" : "test",  "primary" : "shard0000",  "partitioned" : true }
        test.test1
                shard key: { "_id" : 1 }
                chunks:
                        shard0000       1
>>>>>>>>>>      { "_id" : { "$minKey" : 1 } } -->> { "_id" : { "$maxKey" : 1 } } on : shard0000 Timestamp(1, 0)
...



 Comments   
Comment by Githook User [ 10/Aug/15 ]

Author:

{u'username': u'hanumantmk', u'name': u'Jason Carey', u'email': u'jcarey@argv.me'}

Message: SERVER-19747 print Min/MaxKey as json where needed

Min/MaxKey have typeof "function" rather than "object" under
spidermonkey. Change our shell javascript to print correctly for tojson
and the shellPrintHelper.
Branch: master
https://github.com/mongodb/mongo/commit/bed94851c02602dcf4ba9dcec376cfda7f33e657

Comment by Mira Carey [ 04/Aug/15 ]

It looks like we have a bunch of javascript floating around that relied on typeof MinKey == 'object', rather than 'function' (anything with an implementation provided [[Call]] is supposed to fall into that category).

I'm taking a look

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