@@ -8,12 +8,7 @@ import {
88} from '@sofie-automation/corelib/dist/mongo'
99import { ProtectedString , unprotectString } from '@sofie-automation/corelib/dist/protectedString'
1010import { Meteor } from 'meteor/meteor'
11- import {
12- UpdateOptions ,
13- IndexSpecifier ,
14- MongoCursor ,
15- FindOptions ,
16- } from '@sofie-automation/meteor-lib/dist/collections/lib'
11+ import { UpdateOptions , IndexSpecifier , FindOptions } from '@sofie-automation/meteor-lib/dist/collections/lib'
1712import type {
1813 Collection as RawCollection ,
1914 CreateIndexesOptions ,
@@ -25,7 +20,7 @@ import { MongoFieldSpecifier } from '@sofie-automation/corelib/dist/mongo'
2520import { profiler } from '../../api/profiler'
2621import { logger } from '../../logging'
2722import { PromisifyCallbacks } from '@sofie-automation/shared-lib/dist/lib/types'
28- import { AsyncOnlyMongoCollection } from '../collection'
23+ import { AsyncOnlyMongoCollection , MinimalMongoCursor } from '../collection'
2924import { getMongoDb } from '../mongoConnection'
3025import {
3126 observeChangesViaChangeStream ,
@@ -35,15 +30,6 @@ import {
3530import { ChangeStreamCursor } from '../changeStream/changeStreamCursor'
3631import { subscribeToCollectionChangeFeed } from '../changeStream/collectionChangeFeed'
3732
38- /**
39- * A stripped down version of a cursor, with only the async methods used by the codebase, plus the name of
40- * the collection it came from (used by the publish layer to address DDP messages).
41- */
42- export type MinimalMongoCursor < T extends { _id : ProtectedString < any > } > = Pick <
43- MongoCursor < T > ,
44- 'fetchAsync' | 'observeChangesAsync' | 'observeAsync' | 'countAsync'
45- > & { readonly collectionName : string | null }
46-
4733/**
4834 * Translate a meteor-lib {@link FindOptions} into the options the native `mongodb` driver accepts.
4935 * This is an explicit allow-list: only options known to be understood by the driver are forwarded.
@@ -168,22 +154,13 @@ export class WrappedAsyncMongoCollection<
168154
169155 async findWithCursor (
170156 selector ?: MongoQuery < DBInterface > | DBInterface [ '_id' ] ,
171- options ?: FindOptions < DBInterface >
157+ options ?: Omit < FindOptions < DBInterface > , 'fields' >
172158 ) : Promise < MinimalMongoCursor < DBInterface > > {
173159 const sel = this . mongoSelector ( selector )
174160 return new ChangeStreamCursor < DBInterface > ( {
175161 collectionName : this . name ,
176162 selector : sel ,
177163 projection : this . projectionOf ( options ) ,
178- fetch : async ( ) => this . findFetchAsync ( sel , options ) ,
179- // When applySkipLimit is false, strip skip/limit so the count reflects the total matching set.
180- count : async ( applySkipLimit ) =>
181- this . countDocuments (
182- sel ,
183- applySkipLimit
184- ? options
185- : ( { ...options , skip : undefined , limit : undefined } as FindOptions < DBInterface > )
186- ) ,
187164 makeDeps : ( ) => this . observeDeps ( sel ) ,
188165 } )
189166 }
0 commit comments