-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Empty show more show less
When creating properties with value of Code() (plus context), querying documents with this properties does not return correct result.
The following code inserts a document, but when querying it with a non-matching query, it is returned (see the context: the context in the query is different from the context in the document, and it is still being returned).
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');
var db = new Db('jiras', new Server("127.0.0.1", 27017,
),
{w: 0, native_parser: false});
db.open(function (err, db) {
db.dropCollection("code", function (err, result) {
db.createCollection('code', function (err, collection) {
if (err)
var codeDocument = {"x": new Code("function () {}",
{a: 55}), "comment": "Code w/scope a:55"};
console.log("original document:");
console.log(codeDocument);
collection.insert(codeDocument,
{w: 1}, function (err, result) {
var codeQuery = {"x": new Code("function () {}",
)};
var cursor;
var cursorStream;
assert.equal(null, err);
cursor = collection.find(codeQuery);
cursorStream = cursor.stream();
cursorStream.on("data", function (docs)
);
cursorStream.on("close", function ()
);
});
});
});
});