Issues with secondary indexes
See original GitHub issueHello,
I’m using Ottoman.js v2.2.0. I have a few models with different types of indexes.
When I start the application (which calls await ottoman.start()
I see the following issues:
- I have the following index on a few models, however the index is created only for the first one:
mySchema.index.findById = {
by: '_id',
type: 'n1ql'
};
![image](https://user-images.githubusercontent.com/3330932/167031354-f69e40c0-2287-47e7-b9f1-be39de0ed6c6.png)
- On the CB Admin UI I don’t see
refdoc
indexes, defined like this:
mySchema.index.findByTest = {
by: 'test',
type: 'refdoc'
};
-
All index names are prefixed by
__default__default
. I guess that’s the collection name + scope name, but is there a way to specify a custom name for an index? (I couldn’t find any prop with TS autocomplete) -
There’s a default index being created with some strange name. Why is it created and why does it have such a name?
-
I see the following output when
debug
mode is enabled. Seems it tries to create the default index for each of the models (I have 7 models, so the first one is succeeded and 6 are failed). Also instead of seeing the other index names, it outputs justundefined
s. -
I created two indexes: one based on field A and field B and another one based on field A only, like the following:
/* first index */
mySchema.index.findByAandB = {
by: ['A', 'B'],
type: 'n1ql'
};
/* second index */
mySchema.index.findByA = {
by: 'A',
type: 'n1ql'
};
When I run a query like this: select * from test_bucket where A="test"
, the Advice tab shows that the second index has been used (which is correct).
When I run the following query: select * from test_bucket where A="test" and B="test"
, the Advice tab shows that the first index has been used (also correct).
However, when I run the first query again after the second one, it always shows that the first index is being used although there’s no condition on field B in the query.
Thanks
Issue Analytics
- State:
- Created a year ago
- Comments:10
@gsi-alejandro thanks a lot!
@kishmiryan-karlen the next release will be this week or the next one.
By the way, I already fixed these issues.