-
Notifications
You must be signed in to change notification settings - Fork 72
Open
Description
Hi there,
I've found what I think is a bug. In summary, when using setData to set the collection contents and there is an index, lookups using this index can return duplicate data.
var testCol=db.collection('testCol');
testCol.setData([{"a":1,"b":1},{"a":2,"b":2},{"a":3,"b":3}]);
testCol.find();
//returns 3 items, that's OK
testCol.find({"a":2});
//returns 1 item, that's also OK
testCol.ensureIndex({"a":1});
testCol.setData([{"a":1,"b":4},{"a":2,"b":5},{"a":3,"b":6}]);
testCol.find();
//returns 3 items, the last setData replaced old data
testCol.find({"a":2});
//returns 2 items, [ {"a":2,"b":2} , {"a":2,"b":5} ] , that's not OKAs a workaround, using truncate before setData works fine.
Probably setData is not updating the indexes.
Edit:
Forgot to say, I'm using Forerunner 2.0.22.