File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
packages/mongodb-memory-server-core/src Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -242,6 +242,17 @@ export default class MongoMemoryReplSet extends EventEmitter {
242242
243243 try {
244244 const db = await conn . db ( this . opts . replSet . dbName ) ;
245+
246+ // MongoClient HACK which helps to avoid the following error:
247+ // "RangeError: Maximum call stack size exceeded"
248+ // in ./node_modules/mongodb/lib/core/sdam/topology_description.js:263:51
249+ // Under the hood initiated server topology has type `RSGhost`
250+ // and this server does not support session
251+ // so for skipping the following code
252+ // https://github.com/mongodb/node-mongodb-native/blob/dc70c2de7d3dae2617708c45a1ea695d131e15f3/lib/operations/execute_operation.js#L33-L39
253+ // we just override shouldCheckForSessionSupport() method for current connection instance
254+ ( db as any ) . topology . shouldCheckForSessionSupport = ( ) => false ;
255+
245256 this . admin = db . admin ( ) ;
246257 const members = uris . map ( ( uri , idx ) => ( { _id : idx , host : getHost ( uri ) } ) ) ;
247258 const rsConfig = {
You can’t perform that action at this time.
0 commit comments