bugfix: pagination crash due to memory limitation 69/36569/1
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)
commitfe167ee5b7cb84897c06fdc7a8b20342defff9bf
tree09e0e6612b80319cecfee10e5adcdea9daf90229
parent6a9f0ce6edf92e57282ff7b69fb3d47e75234833
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>
utils/test/testapi/opnfv_testapi/resources/handlers.py
utils/test/testapi/opnfv_testapi/resources/result_handlers.py
utils/test/testapi/opnfv_testapi/tests/unit/fake_pymongo.py