mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
add a configuration option for default promise resolver
This commit is contained in:
@@ -619,9 +619,9 @@ CollectionPrototype._callMutatorMethodAsync = function _callMutatorMethodAsync(n
|
||||
|
||||
const mutatorMethodName = this._prefix + name;
|
||||
return this._connection.applyAsync(mutatorMethodName, args, {
|
||||
returnStubValue: true,
|
||||
returnStubValue: Meteor.isClient && (this.promiseResolver === 'stub' || this.promiseResolver == null),
|
||||
// StubStream is only used for testing where you don't care about the server
|
||||
returnServerResultPromise: !this._connection._stream._isStub,
|
||||
returnServerResultPromise: !this._connection._stream._isStub || Meteor.isClient && this.promiseResolver === 'server',
|
||||
...options,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -89,6 +89,8 @@ Mongo.Collection = function Collection(name, options) {
|
||||
|
||||
this._transform = LocalCollection.wrapTransform(options.transform);
|
||||
|
||||
this.promiseResolver = options.promiseResolver;
|
||||
|
||||
if (!name || options.connection === null)
|
||||
// note: nameless collections never have a connection
|
||||
this._connection = null;
|
||||
@@ -1266,4 +1268,3 @@ function popCallbackFromArgs(args) {
|
||||
return args.pop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user