You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@allura.apache.org by Dave Brondsema <da...@brondsema.net> on 2017/03/13 20:56:53 UTC
[allura:tickets] #8146 Index error with mongo 3.4
- **status**: open --> review
- **assigned_to**: Dave Brondsema
- **Comment**:
Fix on branch db/8146
---
** [tickets:#8146] Index error with mongo 3.4**
**Status:** review
**Milestone:** unreleased
**Created:** Tue Feb 28, 2017 04:18 PM UTC by Dave Brondsema
**Last Updated:** Tue Feb 28, 2017 04:18 PM UTC
**Owner:** Dave Brondsema
Running `paster setup-app` command with mongo 3.4 gives:
```
File "/allura/Allura/allura/websetup/__init__.py", line 38, in setup_app
bootstrap.bootstrap(command, conf, vars)
File "/allura/Allura/allura/websetup/bootstrap.py", line 103, in bootstrap
index.run([''])
File "/allura-data/virtualenv/local/lib/python2.7/site-packages/paste/script/command.py", line 238, in run
result = self.command()
File "/allura/Allura/allura/command/show_models.py", line 240, in command
self._update_indexes(db[name], indexes)
File "/allura/Allura/allura/command/show_models.py", line 292, in _update_indexes
collection.ensure_index(idx.index_spec, **idx.index_options)
File "/allura-data/virtualenv/local/lib/python2.7/site-packages/pymongo/collection.py", line 1186, in ensure_index
return self.create_index(key_or_list, cache_for, **kwargs)
File "/allura-data/virtualenv/local/lib/python2.7/site-packages/pymongo/collection.py", line 1069, in create_index
indexes=[index])
File "/allura-data/virtualenv/local/lib/python2.7/site-packages/pymongo/database.py", line 439, in command
uuid_subtype, compile_re, **kwargs)[0]
File "/allura-data/virtualenv/local/lib/python2.7/site-packages/pymongo/database.py", line 345, in _command
msg, allowable_errors)
File "/allura-data/virtualenv/local/lib/python2.7/site-packages/pymongo/helpers.py", line 182, in _check_command_response
raise OperationFailure(msg % errmsg, code, response)
OperationFailure: command SON([('createIndexes', u'basestats'), ('indexes', [{'sparse': False, 'unique': True, 'name': u'_id_1', 'key': SON([('_id', 1)])}])]) on namespace allura.$cmd failed: The field 'sparse' is not valid for an _id index specification. Specification: { ns: "allura.basestats", v: 1, sparse: false, unique: true, name: "_id_1", key: { _id: 1 } }
```
https://docs.mongodb.com/manual/release-notes/3.4-compatibility/#stricter-validation-of-index-specifications doesn't specifically mention sparse `_id`, but looks like that is the change that is causing this.
So I guess we need to omit `sparse: False` on `_id` fields, or any time it's false.
---
Sent from forge-allura.apache.org because dev@allura.apache.org is subscribed to https://forge-allura.apache.org/p/allura/tickets/
To unsubscribe from further messages, a project admin can change settings at https://forge-allura.apache.org/p/allura/admin/tickets/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.