Under High Throughput, Loki returns zero results although data exists
Under High Throughput, Loki returns zero results although data exists.
When querying the same code version, in a different (non-production) server, it responds with the data.
Data source for all servers is the same (REST API).
I create the database with the following code and query it using chain.
var db = new loki('aaa'),
myDb = db.addCollection('aaa', {
indices: ['b', 'c', 'd', 'e', 'f'],
unique: ['a'],
autoupdate: true
});
var results = myDb.chain()
.find({
'$or': [
{
'$and': [
{'b': b},
{'c': c},
{'d': d},
{'e': e},
{'f': f}
]
},
{
'$and': [
{'b': b},
{'c': c},
{'d': {'$in': ['1','2','3']}},
{'e': e}
]
}
]
})
Will need more information...
- first confirm this is using node
- confirm what node versions you are running
- confirm how old your lokijs.js or lokijs.min.js are and if obtained via npm or GitHub
- does your data persists or is it easily rebuilt
- any idea how many documents or mb your database is, maybe run db.serialize().length for bytecount
Without a reproducible example or more details I'll just make a few observations / suggestions / workarounds :
- Object.observe has been deprecated and may have been dropped from node or browsers so I suggest you verify if that is the issue by not passing in 'autoupdate' option to collections and manually calling update() after modifying a hosted object reference
- You could try passing in an adaptiveBinaryIndices : false option to collection constructor to see if there are any issues with that newly added code path.
- we also modified the $in operator to use binary indices so any difference in lokijs versions could potentially show different behavior in that op.
@obeliskos for the sake of speeding it up and saving your precious time you should consider creating a template for signaling issues.
bash-4.3# uname -a Linux worker-1732904807-480j1 4.4.21+ #1 SMP Wed Oct 26 13:00:52 PDT 2016 x86_64 Linux bash-4.3# grep loki package.json "lokijs": "^1.4.1", bash-4.3# npm -v 3.10.9 bash-4.3# node -v v6.2.0
I will provide a working example in a few hours
Thanks, that helps. @techfort has been doing versioning and npm publishing and we have not updated npm or even GitHub package.json in awhile so that lokijs version does not tell me too much. Did you get it through npm? npm version is several months old.
We should be due for another npm update soon but I will try to reproduce with npm copy as well as lastest GitHub master branch. Maybe after we determine if there is bug remaining in master we can publish (or publish again).
I will look over what you come up with later tonight. If unable to provide simple repro case, I believe node 6.3.0+ supports Chrome DevTools debugging capability. Might help to pin down why that method thinks there's no data.
Thank you for your response @obeliskos. Where can I post the code in a more private place? This code, although large sections removed from it, is still proprietary.
I guess you can coordinate via my [email protected] email. Either post there or secret gist or download.
@obeliskos Slightly related, I just spent the last 20 minutes trying to figure out why LokiMemoryAdapter was included in the docs and examples, but couldn't be found in the files from NPM. Might want to put a disclaimer on the docs that they include changes not published to NPM, or point to the docs from the last published version: https://cdn.rawgit.com/techfort/LokiJS/v1.4.1/jsdoc/Loki.html
@CodeLenny @obeliskos published a v1.4.2, let me know if this resolves it.
@techfort Worked for me, but I had different problems then @rotemfogel.
I'd still recommend modifying the docs so that users don't wind up with mismatching docs/code in the future.
Thanks @techfort, I know a lot of users will appreciate that.
@CodeLenny, just fyi, GitHub cloners will always have a copy of their version of the documentation in the jsdocs folder and npm users can generate via :
npm run jsdoc
@rotemfogel did have a separate issue which I never heard more from him about, but if he was using the older loki npm release, I would definitely recommend he update to 1.4.2.
@obeliskos thanks for the response. I am upgrading to 1.4.2. Will let you know if problem resolved.
Closing for lack of need-for-fix on my side....