Fix MongoDB sharded

@Nakomis can you please review.

I couldn't reproduce the other error you were seeing yet. Let's discuss again tomorrow, hopefully with these fixes in place.