mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Until I do the right thing, it's slightly more right to do the query before
listening.
This commit is contained in:
@@ -337,6 +337,12 @@ MongoConnection.prototype._observeChangesWithOplog = function (
|
||||
callbacks.removed && callbacks.removed(id);
|
||||
};
|
||||
|
||||
// XXX the ordering here is wrong
|
||||
var initialCursor = new Cursor(self, cursorDescription);
|
||||
initialCursor.forEach(function (initialDoc) {
|
||||
add(initialDoc);
|
||||
});
|
||||
|
||||
var oplogHandle = self._oplogHandle.onOplogEntry(cursorDescription.collectionName, function (op) {
|
||||
var id;
|
||||
if (op.op === 'd') {
|
||||
@@ -353,8 +359,9 @@ MongoConnection.prototype._observeChangesWithOplog = function (
|
||||
|
||||
// XXX what if selector yields? for now it can't but later it could have
|
||||
// $where
|
||||
if (selector(op.o))
|
||||
if (selector(op.o)) {
|
||||
add(op.o);
|
||||
}
|
||||
} else if (op.op === 'u') {
|
||||
id = op.o2._id;
|
||||
|
||||
@@ -423,11 +430,6 @@ MongoConnection.prototype._observeChangesWithOplog = function (
|
||||
}
|
||||
);
|
||||
|
||||
var initialCursor = new Cursor(self, cursorDescription);
|
||||
initialCursor.forEach(function (initialDoc) {
|
||||
add(initialDoc);
|
||||
});
|
||||
|
||||
var observeHandle = {
|
||||
stop: function () {
|
||||
oplogHandle.stop();
|
||||
|
||||
Reference in New Issue
Block a user