private static Type ResolveProviderType(BsonValue elementValue, bool isKey)
{
if (elementValue.GetType() == typeof(BsonArray) || elementValue.GetType() == typeof(BsonDocument))
{
return elementValue.GetType();
}
else if (BsonTypeMapper.MapToDotNetValue(elementValue) != null)
{
return GetRawValueType(elementValue, isKey);
}
else
{
return null;
}
}