-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 1.4.2
-
Component/s: None
-
Labels:
-
Environment:.Net 4.5, Windows 7, C# driver 1.4.2
Here is a small console application to reproduce the bug
namespace ConsoleApplication1
{
class Program
{
class A
{
public ObjectId Id
public string Name { get; set; }
public int counter
{ get; set; } }
static void Main(string[] args)
{
var a = new A()
;
JavaScriptSerializer json = new JavaScriptSerializer();
var s = json.Serialize(a);
var b = json.Deserialize<A>(s);
}
}
}
a and b are different. b does match Name and counter field but Id are different.
A.Id = 4fc68f495669bd1ba000e831
B.Id = 000000000000000000000000
s = {\"Id\":
{\"Timestamp\":1338412873,\"Machine\":5663165,\"Pid\":7072,\"Increment\":59441,\"CreationTime\":\"\\/Date(1338412873000)\\/\"},\"Name\":\"Test1\",\"counter\":1}
FYI, python serialized ObjectId looks like this:
>>> json.dumps(d, default=json_util.default)
'{"_id":
{"$oid": "4fc68f495669bd1ba000e831"}, "Name": "Test1", "counter":1}'
Do you think JSON serialized ObjectId can match between drivers? (GUID JSON output are also different between drivers)