diff --git a/CHANGELOG.md b/CHANGELOG.md index eacd77f..931e84b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Change Log +## 4.1.0 + +New feature to disable indexing through setting a variable in Meteor settings + ## 4.0.0 Package now depends on `aldeed:simple-schema` instead of NPM package. diff --git a/README.md b/README.md index d742491..ad62db1 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,20 @@ You can use the `sparse` option along with the `index` and `unique` options to t All indexes are built in the background so indexing does *not* block other database queries. +## Disabling Indexing + +If you want to disable indexing via collection2 for your app you can set the following variable in your settings: + +```js +{ + "packages": { + "collection2": { + "disableIndexing": true + } + } +} +``` + ## Contributing Anyone is welcome to contribute. Fork, make and test your changes (`meteor test-packages ./`), and then submit a pull request. diff --git a/package/indexing/package.js b/package/indexing/package.js index 40ee68e..c3e4bf2 100644 --- a/package/indexing/package.js +++ b/package/indexing/package.js @@ -1,7 +1,7 @@ Package.describe({ name: 'aldeed:schema-index', summary: 'Control some MongoDB indexing with schema options', - version: '4.0.1', + version: '4.1.0', documentation: '../../README.md', git: 'https://github.com/aldeed/meteor-schema-index.git', }); diff --git a/package/indexing/server.js b/package/indexing/server.js index 1c054aa..7e47938 100644 --- a/package/indexing/server.js +++ b/package/indexing/server.js @@ -4,6 +4,8 @@ import { Meteor } from 'meteor/meteor'; import './common'; Collection2.on("schema.attached", (collection, ss) => { + if (Meteor.settings?.packages?.collection2?.disableIndexing) return; + function ensureIndex(index, name, unique, sparse) { Meteor.startup(() => { collection.createIndexAsync(index, {