Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion package/indexing/package.js
Original file line number Diff line number Diff line change
@@ -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',
});
Expand Down
2 changes: 2 additions & 0 deletions package/indexing/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down
Loading