bugfix: pagination crash due to memory limitation
authorSerenaFeng <feng.xiaowei@zte.com.cn>
Tue, 27 Jun 2017 11:13:32 +0000 (19:13 +0800)
committerSerenaFeng <feng.xiaowei@zte.com.cn>
Tue, 27 Jun 2017 11:13:32 +0000 (19:13 +0800)
commitf97aba63106515a44ccda2bade003e9ee3503ec0
tree40e8c39a837846f54b97bb037e137940fc45bd1f
parent83d399af614f359f3071e663a245cd1c5cf6480c
bugfix: pagination crash due to memory limitation

MongoDB sorts the results in memory, and the default mem limitation is
32M, if the sort operation consumes more than that it will return an
error:
OperationFailure: Executor error during find command: OperationFailed
Sort operation used more than the maximum 33554432 bytes of RAM. Add an
index, or specify a smaller limit.

To solve this problem, here we leverage aggregate() and
allowDiskUse=True, it is said will not be limited by memory

Change-Id: Id698ad1d02912e8b350a33a926fcccc390814fcc
Signed-off-by: SerenaFeng <feng.xiaowei@zte.com.cn>
testapi/opnfv_testapi/resources/handlers.py
testapi/opnfv_testapi/resources/result_handlers.py
testapi/opnfv_testapi/tests/unit/fake_pymongo.py