Skip to content

Commit

Permalink
docs(mongoose): make useCreateIndex always false in docs
Browse files Browse the repository at this point in the history
Fix #10033
  • Loading branch information
vkarpov15 committed Apr 17, 2021
1 parent 61d24d4 commit 95f8fe7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ Connection.prototype.onOpen = function() {
* @param {Number} [options.heartbeatFrequencyMS] If `useUnifiedTopology = true`, the MongoDB driver sends a heartbeat every `heartbeatFrequencyMS` to check on the status of the connection. A heartbeat is subject to `serverSelectionTimeoutMS`, so the MongoDB driver will retry failed heartbeats for up to 30 seconds by default. Mongoose only emits a `'disconnected'` event after a heartbeat has failed, so you may want to decrease this setting to reduce the time between when your server goes down and when Mongoose emits `'disconnected'`. We recommend you do **not** set this setting below 1000, too many heartbeats can lead to performance degradation.
* @param {Boolean} [options.autoIndex=true] Mongoose-specific option. Set to false to disable automatic index creation for all models associated with this connection.
* @param {Boolean} [options.useNewUrlParser=false] False by default. Set to `true` to opt in to the MongoDB driver's new URL parser logic.
* @param {Boolean} [options.useCreateIndex=true] Mongoose-specific option. If `true`, this connection will use [`createIndex()` instead of `ensureIndex()`](/docs/deprecations.html#ensureindex) for automatic index builds via [`Model.init()`](/docs/api.html#model_Model.init).
* @param {Boolean} [options.useCreateIndex=false] Mongoose-specific option. If `true`, this connection will use [`createIndex()` instead of `ensureIndex()`](/docs/deprecations.html#ensureindex) for automatic index builds via [`Model.init()`](/docs/api.html#model_Model.init).
* @param {Boolean} [options.useFindAndModify=true] True by default. Set to `false` to make `findOneAndUpdate()` and `findOneAndRemove()` use native `findOneAndUpdate()` rather than `findAndModify()`.
* @param {Number} [options.reconnectTries=30] If you're connected to a single server or mongos proxy (as opposed to a replica set), the MongoDB driver will try to reconnect every `reconnectInterval` milliseconds for `reconnectTries` times, and give up afterward. When the driver gives up, the mongoose connection emits a `reconnectFailed` event. This option does nothing for replica set connections.
* @param {Number} [options.reconnectInterval=1000] See `reconnectTries` option above.
Expand Down
3 changes: 2 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ function Mongoose(options) {
// default global options
this.options = Object.assign({
pluralization: true,
autoIndex: true
autoIndex: true,
useCreateIndex: false
}, options);
const conn = this.createConnection(); // default connection
conn.models = this.models;
Expand Down
1 change: 0 additions & 1 deletion test/model.discriminator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1677,7 +1677,6 @@ describe('model', function() {
});

map = yield Map.findById(map).populate({ path: 'tiles.enemy' });
console.log(map.tiles);
assert.equal(map.tiles[0][0].enemy.name, 'Bowser');
});
});
Expand Down

0 comments on commit 95f8fe7

Please sign in to comment.