[SERVER-19171] Shell does not always use extended JSON Shell Syntax Created: 27/Jun/15  Updated: 06/Dec/22  Resolved: 03/Dec/21

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

Type: Bug Priority: Minor - P4
Reporter: Thomas Rueckstiess Assignee: Backlog - Server Tooling and Methods (STM) (Inactive)
Resolution: Won't Fix Votes: 3
Labels: move-stm
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by SERVER-44717 MinKey > MaxKey in agg language Closed
Related
is related to SERVER-6102 Shell displays both 'undefined' and '... Closed
is related to SERVER-19747 MinKey/MaxKey not printing as JSON in... Closed
is related to SERVER-32862 sh.addShardToZone() allows unusual (i... Closed
is related to SERVER-8060 MinKey/MaxKey print incorrect V8 Closed
is related to SERVER-24562 Enhance shell to output strict json Closed
is related to SERVER-34644 Disable `DollarPrefixedFieldName` che... Closed
is related to SERVER-13209 Ensure extended shell JSON ouput form... Closed
Assigned Teams:
Server Tooling & Methods
Operating System: ALL
Participants:

 Description   

For most types, the shell prints values in extended JSON shell mode, which is why we have the shell mode flavor of eJSON in the first place (shell can parse the output again).

However, for MinKey and MaxKey (at least), this is not the case, and the shell instead prints out the strict syntax.

MongoDB shell version: 3.1.3
connecting to: test
Server has startup warnings:
2015-06-27T16:39:10.891+1000 I CONTROL  [initandlisten]
2015-06-27T16:39:10.891+1000 I CONTROL  [initandlisten] ** NOTE: This is a development version (3.1.3) of MongoDB.
2015-06-27T16:39:10.892+1000 I CONTROL  [initandlisten] **       Not recommended for production.
2015-06-27T16:39:10.892+1000 I CONTROL  [initandlisten]
> Timestamp(3, 5)
Timestamp(3, 5)
> DBRef("foo", "bar")
DBRef("foo", "bar")
> MinKey
{ "$minKey" : 1 }
> MaxKey
{ "$maxKey" : 1 }

I'd expect the shell to print out MinKey and MaxKey instead.



 Comments   
Comment by Brooke Miller [ 03/Dec/21 ]

We've deprecated the mongo shell in favor of the new mongosh . Unfortunately, we aren't able to pursue improvements to the deprecated shell except in extreme cases, such as critical security fixes. Please start making use of mongosh and let us know if it works for you in this case.

Comment by Thomas Rueckstiess [ 27/Jun/15 ]

Date is another type that is not printed in correct shell mode extended JSON. http://docs.mongodb.org/manual/reference/mongodb-extended-json/#date states that the output has to be of form new Date( <epoch_in_ms> ).

> new Date(2015, 01, 01)
ISODate("2015-01-31T13:00:00Z")

Note that SERVER-13209 mentions this case but claims the shell outputs as Date(...), but it is output as ISODate(...), at least in version 3.1.3.

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