SERVER-6246 Check for existence of "code" field before accessing it when creating a user doc