Do not attach collection to index if duplicate.
This commit is contained in:
parent
644ebd0a4f
commit
e963938016
@ -178,14 +178,15 @@ export default class Collection extends EventEmitter {
|
|||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
|
|
||||||
createIndex (name, index) {
|
createIndex (name, index) {
|
||||||
index._attachCollection(this)
|
|
||||||
|
|
||||||
const {_indexes: indexes} = this
|
const {_indexes: indexes} = this
|
||||||
if (hasOwnProperty.call(indexes, name)) {
|
if (hasOwnProperty.call(indexes, name)) {
|
||||||
throw new DuplicateIndex(name)
|
throw new DuplicateIndex(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
indexes[name] = index
|
indexes[name] = index
|
||||||
this._indexedItems[name] = index.items
|
this._indexedItems[name] = index.items
|
||||||
|
|
||||||
|
index._attachCollection(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteIndex (name) {
|
deleteIndex (name) {
|
||||||
|
Loading…
Reference in New Issue
Block a user