-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Empty show more show less
When inserting a document with a property of value Timestamp() and this is queried, then this works fine.
However, if the dataset contains a second document with a property of Date(), completely unrelated to the first document, and a query for Timestamp() is issued, the driver errors out.
The following code shows the error case. If you comment out the document with the Date() property, the query works on the single document.
var Db = require('mongodb').Db,
Server = require('mongodb').Server,
ObjectID = require('mongodb').ObjectID,
Binary = require('mongodb').Binary,
GridStore = require('mongodb').GridStore,
Code = require('mongodb').Code,
BSON = require('mongodb').pure().BSON,
assert = require('assert'),
MongoDB = require('mongodb');
var db = new Db('jiras', new Server("127.0.0.1", 27017,
),
{w: 0, native_parser: false});
db.open(function (err, db) {
db.dropCollection("timestamp", function (err, result) {
db.createCollection('timestamp', function (err, collection) {
if (err)
var timestampDocument =
{"x": new MongoDB.Timestamp(1, 2), "comment": "Timestamp(1,2)"};
var dateDocument =
;
console.log("original document:");
console.log(timestampDocument);
console.log(dateDocument);
collection.insert([timestampDocument, dateDocument],
{w: 1}, function (err, result) {
var timestampQuery =
;
var cursor;
var cursorStream;
assert.equal(null, err);
cursor = collection.find(timestampQuery);
cursorStream = cursor.stream();
cursorStream.on("data", function (docs)
);
cursorStream.on("close", function ()
);
cursorStream.on("error", function (err)
);
});
});
});
});