Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vb.net 为什么MongoDB.Bson.BsonExtensionMethods.ToBson返回字节数组而不是字符串?_Vb.net_Mongodb - Fatal编程技术网

Vb.net 为什么MongoDB.Bson.BsonExtensionMethods.ToBson返回字节数组而不是字符串?

Vb.net 为什么MongoDB.Bson.BsonExtensionMethods.ToBson返回字节数组而不是字符串?,vb.net,mongodb,Vb.net,Mongodb,我们如何将字节数组转换成字符串 我做到了: Dim queryPlaces = Query.WithinRectangle("LongitudeLatitude", (Longitude - eachStepLongitude), (Latitude - minimumBlock), (Longitude + eachStepLongitude), (Latitude + minimumBlock)) LogEvents(queryPlaces.ToBs

我们如何将字节数组转换成字符串

我做到了:

 Dim queryPlaces = Query.WithinRectangle("LongitudeLatitude", (Longitude - eachStepLongitude), (Latitude - minimumBlock), (Longitude + eachStepLongitude), (Latitude + minimumBlock))
                    LogEvents(queryPlaces.ToBson.ToString)
这是用于vb.net语言的mongdob驱动程序

我惊讶地发现queryPlaces.ToBson返回字节而不是字符串。另外,ToBson.ToString只返回这个无用的字符串:

System.Byte[]

要获得可读字符串,更容易使用
ToJSON
ToBSON
返回。

如果您想要一个可读的字符串,为什么不使用
ToJSON
?BSON中的“B”代表“二进制”,因此您会看到……啊。请把它变成一个答案。