Fix https://github.com/julianhyde/optiq/issues/164, "Improve query performance of optiq over mongo".