-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: 3.6.0
-
Component/s: None
-
(copied to CRM)
-
Empty show more show less
Hello, I have been using the Node Mongo driver successfully for many years. However, when we upgraded to 3.6.0 our code began to break during our app's startup throwing the following error:
(node:90414) UnhandledPromiseRejectionWarning: MongoError: not master at MessageStream.messageHandler (/Users/jpavlic1/core/app/node_modules/mongodb/lib/cmap/connection.js:266:20) at MessageStream.emit (events.js:311:20) at MessageStream.EventEmitter.emit (domain.js:482:12) at processIncomingData (/Users/jpavlic1/core/app/node_modules/mongodb/lib/cmap/message_stream.js:144:12) at MessageStream._write (/Users/jpavlic1/core/app/node_modules/mongodb/lib/cmap/message_stream.js:42:5) at doWrite (_stream_writable.js:441:12) at writeOrBuffer (_stream_writable.js:425:5) at MessageStream.Writable.write (_stream_writable.js:316:11) at Socket.ondata (_stream_readable.js:714:22) at Socket.emit (events.js:311:20) at Socket.EventEmitter.emit (domain.js:482:12) at addChunk (_stream_readable.js:294:12) at readableAddChunk (_stream_readable.js:275:11) at Socket.Readable.push (_stream_readable.js:209:10) at TCP.onStreamRead (internal/stream_base_commons.js:186:23)
I traced this to a step in our code where we do a createIndex on a collection that already exists, and already has the index. The createIndex is there in case we have created a new database and need the index. My connection string looks like this:
mongodb://app-stg-db05.aws.conde.io:10650,app-stg-db06.aws.conde.io:10650,app-stg-db07.aws.conde.io:10650/?replicaSet=app-stg&readPreference=primaryPreferred
One other thing to note - I switched the readPreference to Primary to see if that would work. It did, but it also deleted all the data in the collection. This did not previously happen when using 3.5.x. Is this expected?
Thanks for looking into this
- duplicates
-
NODE-2818 When performing some Init stuff, got "MongoError: not master" error
- Closed
- is duplicated by
-
NODE-2823 createIndex can fail with "MongoError: not master" in v3.6.0+ with a non-primary read preference
- Closed
-
NODE-2855 Create indexes fail
- Closed
- is related to
-
NODE-2832 Ensure all DDL commands use a fixed primary read preference
- Closed