-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
3
Problem Statement/Rationale
What is going wrong? What action would you like the Engineering team to take?
Please be sure to attach relevant logs with any sensitive data redacted.
When working with the playground dates before 1970 (Unix Epoch) are shown as $numberlong negative numbers. The dates should be printed in human-readable format.
The GitHub issue: https://github.com/mongodb-js/vscode/issues/460
Steps to Reproduce
How could an engineer replicate the issue you’re reporting?
Run the following playground:
use('NetflixDB'); db.NetflixActors.insertMany([ { name: 'Elizabeth Debicki', dateOfBirth: new Date("1990-08-24"), nationality: 'French' }, { name: 'Christopher Nolan', dateOfBirth: new Date("1970-07-30"), nationality: 'English', type: ['Director','Writer'] }, { name: 'Guy Ritchie', dateOfBirth: new Date("1968-09-10"), nationality: 'English', type: ['Director','Writer'] }, { name:'Matthew McConaughey', dateOfBirth: new Date("1969-11-4"), nationality: 'American', type: ['Actor'] }, { name:'Charlie Hunnam', dateOfBirth: new Date("1980-04-10"), nationality: 'English', type: ['Actor'] }, { name:'Hugh Grant', dateOfBirth: new Date("1960-09-09"), nationality: 'English', type: ['Actor'] } ]); db.NetflixActors.find({});
Expected Results
What do you expect to happen?
Dates in playground results are printed like UTC date strings.
Actual Results
What do you observe is happening?
Dates in playground results are shown as $numberLong negative values.
[ { "_id": { "$oid": "63e1219b32cd890b9f3656ff" }, "name": "Elizabeth Debicki", "dateOfBirth": { "$date": "1990-08-24T00:00:00Z" }, "nationality": "French" }, { "_id": { "$oid": "63e1219b32cd890b9f365700" }, "name": "Christopher Nolan", "dateOfBirth": { "$date": "1970-07-30T00:00:00Z" }, "nationality": "English", "type": [ "Director", "Writer" ] }, { "_id": { "$oid": "63e1219b32cd890b9f365701" }, "name": "Guy Ritchie", "dateOfBirth": { "$date": { "$numberLong": "-41299200000" } }, "nationality": "English", "type": [ "Director", "Writer" ] }, { "_id": { "$oid": "63e1219b32cd890b9f365702" }, "name": "Matthew McConaughey", "dateOfBirth": { "$date": { "$numberLong": "-5014800000" } }, "nationality": "American", "type": [ "Actor" ] }, { "_id": { "$oid": "63e1219b32cd890b9f365703" }, "name": "Charlie Hunnam", "dateOfBirth": { "$date": "1980-04-10T00:00:00Z" }, "nationality": "English", "type": [ "Actor" ] }, { "_id": { "$oid": "63e1219b32cd890b9f365704" }, "name": "Hugh Grant", "dateOfBirth": { "$date": { "$numberLong": "-293846400000" } }, "nationality": "English", "type": [ "Actor" ] } ]
Additional Notes
Any additional information that may be useful to include.
- related to
-
COMPASS-5744 Date fields show as $numberLong in JSON mode
- Closed
-
DRIVERS-1586 Consider changing relaxed representation of dates before the epoch
- Backlog