apply tmpdir fix to ng version of mongodb

Note: this was a direct copy paste of the non-ng code to make it easier to diff
between the versions.  It could have have used some refactoring, but we
intentionally didn't do that.  Also, eventually, the ng and non-ng need to
converge.  This is pretty brittle.  (Or non-ng just needs to die)

Change-Id: Iaaa91602899126c6b256f80172248fc176cf8bbb