[SERVER-9178] Timestamp does not round trip correctly in V8 Javascript shell Created: 29/Mar/13  Updated: 10/Dec/14  Resolved: 03/Apr/13

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

Type: Bug Priority: Critical - P2
Reporter: Shaun Verch Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-6079 v8 and spidermonkey handle Timestamps... Closed
Related
is related to SERVER-9175 Add more round trip jstests for javas... Closed
Operating System: ALL
Steps To Reproduce:

Spidermonkey (correct)

> interpreterVersion()
SpiderMonkey 1.7
> db.ts.remove()
> db.ts.insert({ ts : Timestamp(5,10) })
> var ts = db.ts.findOne().ts
> ts
Timestamp(5, 10)
> ts.t
5
> ts.i
10
> assert.eq(ts, Timestamp(5,10))
>

V8 (old/incorrect)

> interpreterVersion()
V8 3.12.19
> db.ts.remove()
> db.ts.insert({ ts : Timestamp(5,10) })
> var ts = db.ts.findOne().ts
> ts
{ "t" : 5, "i" : 10 }
> ts.i
10
> ts.t
5
> assert.eq(ts, Timestamp(5,10))
assert: [{ "t" : 5, "i" : 10 }] != [Timestamp(5, 10)] are not equal : undefined
Error: Printing Stack Trace
    at printStackTrace (src/mongo/shell/utils.js:37:15)
    at doassert (src/mongo/shell/assert.js:6:5)
    at Function.assert.eq (src/mongo/shell/assert.js:32:5)
    at (shell):1:8
Fri Mar 29 13:01:50.621 JavaScript execution failed: [{ "t" : 5, "i" : 10 }] != [Timestamp(5, 10)] are not equal : undefined at src/mongo/shell/assert.js:L7
>

Participants:

 Description   

A Timestamp inserted in the V8 shell using the constructor comes out as an ordinary object instead of a Timestamp.

According to http://docs.mongodb.org/manual/core/document/#timestamps, this was changed in 2.1, but apparently only in Spidermonkey.


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