mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Replace underscore usage in mongo package
This commit is contained in:
@@ -1099,7 +1099,7 @@ class AsynchronousCursor {
|
||||
if (!doc) return null;
|
||||
doc = replaceTypes(doc, replaceMongoAtomWithMeteor);
|
||||
|
||||
if (!this._cursorDescription.options.tailable && _.has(doc, '_id')) {
|
||||
if (!this._cursorDescription.options.tailable && doc._id) {
|
||||
// Did Mongo give us duplicate documents in the same cursor? If so,
|
||||
// ignore this one. (Do this before the transform, since transform might
|
||||
// return some unrelated value.) We don't do this for tailable cursors,
|
||||
@@ -1174,7 +1174,8 @@ class AsynchronousCursor {
|
||||
}
|
||||
|
||||
fetch() {
|
||||
return this.map(_.identity);
|
||||
var self = this;
|
||||
return self.map(x => x);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1634,9 +1635,9 @@ forEachTrigger = async function (cursorDescription, triggerCallback) {
|
||||
cursorDescription.selector);
|
||||
if (specificIds) {
|
||||
for (const id of specificIds) {
|
||||
await triggerCallback(_.extend({id: id}, key));
|
||||
await triggerCallback(Object.assign({id: id}, key));
|
||||
}
|
||||
await triggerCallback(_.extend({dropCollection: true, id: null}, key));
|
||||
await triggerCallback(Object.assign({dropCollection: true, id: null}, key));
|
||||
} else {
|
||||
await triggerCallback(key);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ ObserveMultiplexer = class {
|
||||
const self = this;
|
||||
this.callbackNames().forEach(callbackName => {
|
||||
this[callbackName] = function(/* ... */) {
|
||||
self._applyCallback(callbackName, _.toArray(arguments));
|
||||
self._applyCallback(callbackName, [...arguments]);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ OplogObserveDriver = function (options) {
|
||||
|
||||
};
|
||||
|
||||
_.extend(OplogObserveDriver.prototype, {
|
||||
Object.assign(OplogObserveDriver.prototype, {
|
||||
_init: async function() {
|
||||
const self = this;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ PollingObserveDriver = function (options) {
|
||||
|
||||
};
|
||||
|
||||
_.extend(PollingObserveDriver.prototype, {
|
||||
Object.assign(PollingObserveDriver.prototype, {
|
||||
_init: async function () {
|
||||
const self = this;
|
||||
const options = self._options;
|
||||
|
||||
@@ -47,11 +47,9 @@ Object.assign(MongoInternals.RemoteCollectionDriver.prototype, {
|
||||
});
|
||||
|
||||
CLIENT_ONLY_METHODS.forEach(function (m) {
|
||||
ret[m] = _.bind(self.mongo[m], self.mongo, name);
|
||||
|
||||
ret[m] = function (...args) {
|
||||
throw new Error(
|
||||
`${m} + is not available on the server. Please use ${getAsyncMethodName(
|
||||
`${m} is not available on the server. Please use ${getAsyncMethodName(
|
||||
m
|
||||
)}() instead.`
|
||||
);
|
||||
@@ -88,4 +86,4 @@ MongoInternals.defaultRemoteCollectionDriver = once(function () {
|
||||
});
|
||||
|
||||
return driver;
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user