refs #561, manually backport SERVER-5208
refs #561, manually backport SERVER-8235