[SERVER-5274] updatek.js failing in V8 Created: 09/Mar/12  Updated: 11/Jul/16  Resolved: 13/Mar/12

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

Type: Bug Priority: Major - P3
Reporter: Eric Milkie Assignee: Antoine Girbal
Resolution: Done Votes: 0
Labels: buildbot
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

assert: [{ "1" : { "b" : 1, "c" : 2 }, "01" : { }, "_id" : 0 }] != [{ "01" : { }, "1" : { "b" : 1, "c" : 2 }, "_id" : 0 }] are not equal : undefined



 Comments   
Comment by Antoine Girbal [ 13/Mar/12 ]

when v8 sees numerical keys in object it puts them to the front in order.
It's basically applying same behavior as for an array.

Comment by auto [ 13/Mar/12 ]

Author:

{u'login': u'agirbal', u'name': u'agirbal', u'email': u'antoine@10gen.com'}

Message: SERVER-5274: updatek.js failing in V8
Branch: master
https://github.com/mongodb/mongo/commit/825c8b7fa8cb3e907f651692b4e8410e524d7720

Comment by Aaron Staple [ 12/Mar/12 ]

There aren't any explicit arrays here, just objects with field names that happen to consist of digits. Do we have any choice about whether the v8 engine performs this reordering?

Comment by Antoine Girbal [ 10/Mar/12 ]

Ok so this is a brand new test.
Issue has to do with how v8 reorders the keys when it detects that some keys are part of array.
See here, it puts '0' and '1' to the front:

> doc = { '01':{}, '1':{ b:1, c:2 }, '0': 1,  _id:1, '02': {} }
{
	"0" : 1,
	"1" : {
		"b" : 1,
		"c" : 2
	},
	"01" : {
		
	},
	"_id" : 1,
	"02" : {
		
	}
}

That kind of stuff is not really standardized in JS (when using numeric keys make an object an array, etc)

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