Refactor auxiliary methods for MongoDB unit tests

This patchset DRYes the implementation of auxiliary
functions in MongoDB unit tests.

Change-Id: Ie6a3bfc0d20d8d30bd484a9fec2063e1c191c7c4
Closes-Bug: #1257391
Merge "Refactor auxiliary methods for MongoDB unit tests"