Skip to content

Commit b5ab678

Browse files
committed
chore: document method
1 parent f3baf44 commit b5ab678

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

meteor/server/collections/collection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FindOptions, MongoModifier, MongoQuery } from '@sofie-automation/corelib/dist/mongo'
1+
import { FindOptions, MongoModifier, MongoQuery, ObserveChangesOptions } from '@sofie-automation/corelib/dist/mongo'
22
import { ProtectedString } from '@sofie-automation/corelib/dist/protectedString'
33
import { Meteor } from 'meteor/meteor'
44
import { Mongo } from 'meteor/mongo'
@@ -235,7 +235,7 @@ export interface AsyncOnlyReadOnlyMongoCollection<DBInterface extends { _id: Pro
235235
selector: MongoQuery<DBInterface> | DBInterface['_id'],
236236
callbacks: PromisifyCallbacks<ObserveChangesCallbacks<DBInterface>>,
237237
findOptions?: Omit<FindOptions<DBInterface>, 'fields'>,
238-
callbackOptions?: { nonMutatingCallbacks?: boolean | undefined }
238+
callbackOptions?: ObserveChangesOptions
239239
): Promise<Meteor.LiveQueryHandle>
240240

241241
/**

meteor/server/collections/implementations/asyncCollection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { MongoModifier, MongoQuery } from '@sofie-automation/corelib/dist/mongo'
1+
import { MongoModifier, MongoQuery, ObserveChangesOptions } from '@sofie-automation/corelib/dist/mongo'
22
import { ProtectedString, protectString, unprotectString } from '@sofie-automation/corelib/dist/protectedString'
33
import { Meteor } from 'meteor/meteor'
44
import { Mongo } from 'meteor/mongo'
@@ -142,7 +142,7 @@ export class WrappedAsyncMongoCollection<DBInterface extends { _id: ProtectedStr
142142
selector: MongoQuery<DBInterface> | DBInterface['_id'],
143143
callbacks: PromisifyCallbacks<ObserveChangesCallbacks<DBInterface>>,
144144
findOptions?: FindOptions<DBInterface>,
145-
callbackOptions?: { nonMutatingCallbacks?: boolean | undefined }
145+
callbackOptions?: ObserveChangesOptions
146146
): Promise<Meteor.LiveQueryHandle> {
147147
const span = profiler.startSpan(`MongoCollection.${this.name}.observeChanges`)
148148
if (span) {

packages/corelib/src/mongo.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ export interface FindOneOptions<TDoc> {
4444
export interface FindOptions<TDoc> extends FindOneOptions<TDoc> {
4545
limit?: number
4646
}
47+
48+
export interface ObserveChangesOptions {
49+
/**
50+
* If your observer functions do not mutate the passed arguments, you can set this to true, which
51+
* improves performance by reducing the amount of data copies.
52+
*/
53+
nonMutatingCallbacks?: boolean | undefined
54+
}
55+
4756
/**
4857
* Subset of MongoSelector, only allows direct queries, not QueryWithModifiers such as $explain etc.
4958
* Used for simplified expressions (ie not using $and, $or etc..)

0 commit comments

Comments
 (0)