It is very quick to query in robomongo, below pic show I do retrieve 500 doc back:
I have created index at result.type
, my test code:
def get_test_data(limit):
return collection.find({'result.type':'detail'})[:limit]
def test_one_read_multi_process():
print('mongodb read')
t = Timer()
TASKS = list(get_test_data(500))
print(t.elapsed_time, '\n')
pymongo takes 21.716s , it is too slow.
test on mongodb 3.6, pymongo latest, python 2&3
Maybe relate to Pymongo significantly slower than mongo shell?
But I want a solution .