Don't apply transform for server-side observeChanges (eg publishes).

This commit is contained in:
David Glasser
2013-03-11 20:28:09 -07:00
parent c44d169628
commit 02959efba8
2 changed files with 8 additions and 3 deletions

View File

@@ -378,6 +378,9 @@ _.each(['STRING', 'MONGO'], function (idGeneration) {
}));
},
function (test, expect) {
test.equal(
restrictedCollectionWithTransform.findOne({"a.bar": "bar"}),
{foo: "foo", bar: "bar", baz: "baz"});
restrictedCollectionWithTransform.remove(item1, expect(function (e, res) {
test.isFalse(e);
}));

View File

@@ -374,7 +374,7 @@ _.each(['forEach', 'map', 'rewind', 'fetch', 'count'], function (method) {
if (!self._synchronousCursor)
self._synchronousCursor = self._mongo._createSynchronousCursor(
self._cursorDescription);
self._cursorDescription, true);
return self._synchronousCursor[method].apply(
self._synchronousCursor, arguments);
@@ -433,7 +433,8 @@ Cursor.prototype.observeChanges = function (callbacks) {
self._cursorDescription, ordered, callbacks);
};
_Mongo.prototype._createSynchronousCursor = function (cursorDescription) {
_Mongo.prototype._createSynchronousCursor = function (cursorDescription,
useTransform) {
var self = this;
var future = new Future;
@@ -459,6 +460,7 @@ _Mongo.prototype._createSynchronousCursor = function (cursorDescription) {
throw result[1];
return new SynchronousCursor(result[1],
useTransform &&
cursorDescription.options &&
cursorDescription.options.transform);
};
@@ -814,7 +816,7 @@ _.extend(LiveResultsSet.prototype, {
self._synchronousCursor.rewind();
} else {
self._synchronousCursor = self._mongoHandle._createSynchronousCursor(
self._cursorDescription);
self._cursorDescription, false);
}
var newResults = self._synchronousCursor.getRawObjects(self._ordered);
var oldResults = self._results;