just checking- are you sure it's a dict and not a bson object? same in the next function below.