You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lett;letalarms=[];for(leti=0;i<10000;i++){alarms.push({id: "74590869096"+(907836+i),name: 'hello'+i});}letdb=newloki('exampleDB');letalarmCollection=db.addCollection('myAlarms',{indices: ['id']});console.log(`开始插入。。。`)t=Date.now();alarms.forEach(obj=>alarmCollection.insert(obj));console.log(`完成插入 耗时${(Date.now()-t)/1000}s alarmCollection.count=${alarmCollection.count()}`);letexampleId="74590869096907841";console.log('find by id',alarmCollection.count({id: exampleId}))console.log('find by $in',alarmCollection.count({id: {$in:[exampleId]}}))console.log('find by $keyin',alarmCollection.count({id:{$keyin: {[exampleId]: 'anything'}}}))
result:
开始插入。。。
完成插入 耗时0.045s alarmCollection.count=10000
find by id 1
find by $in 13
find by $keyin 1
This collcetion has an index on id, which is a large numeric string property.
As we can see, while i count/find, $keyin can return correct result, but $in returns Wrong result.
The text was updated successfully, but these errors were encountered:
qiangbro
changed the title
Wrong result while query by $in with an index
Wrong result while quering by $in with an index
Mar 1, 2022
qiangbro
changed the title
Wrong result while quering by $in with an index
Wrong result while quering by $in with an index on a large numeric string property
Mar 1, 2022
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
my code:
result:
This collcetion has an index on
id
, which is a large numeric string property.As we can see, while i count/find,
$keyin
can return correct result, but$in
returns Wrong result.The text was updated successfully, but these errors were encountered: