options.mongooseConnection.once isn't a func

Issue

A TypeError was encountered when attempting to open a Mongoose connection in the following file:

E:\Project\Unofficial_Project\web\node\node-cms\node_modules\connect-mongo\src\index.js:110
          options.mongooseConnection.once('open', () =>
                                     ^
TypeError: options.mongooseConnection.once is not a function

Answer

The error is caused by options.mongooseConnection not being a valid Mongoose connection object. Check that options.mongooseConnection is properly defined and is an instance of mongoose.Connection.