Only show duplicate id warning if really from _id

Fixes #1980
This commit is contained in:
Joe Gallo
2014-06-18 17:36:51 -07:00
committed by David Glasser
parent 4bec4877e3
commit 3c6c8e591c
2 changed files with 3 additions and 2 deletions

View File

@@ -116,7 +116,8 @@ ObserveSequence = {
var idString = idStringify(id); var idString = idStringify(id);
if (idsUsed[idString]) { if (idsUsed[idString]) {
warn("duplicate id " + id + " in", seq); if (typeof item === 'object' && '_id' in item)
warn("duplicate id " + id + " in", seq);
id = Random.id(); id = Random.id();
} else { } else {
idsUsed[idString] = true; idsUsed[idString] = true;

View File

@@ -483,7 +483,7 @@ Tinytest.add('observe sequence - number arrays', function (test) {
{removedAt: [{NOT: 1}, 1, 1]}, {removedAt: [{NOT: 1}, 1, 1]},
{addedAt: [3, 3, 1, 2]}, {addedAt: [3, 3, 1, 2]},
{addedAt: [{NOT: 3}, 3, 3, null]} {addedAt: [{NOT: 3}, 3, 3, null]}
], /*numExpectedWarnings = */2); ]);
}); });
Tinytest.add('observe sequence - cursor to other cursor, same collection', function (test) { Tinytest.add('observe sequence - cursor to other cursor, same collection', function (test) {