简体   繁体   English

MongoDB获取集合数据类型

[英]MongoDB Get collection data types

I have a collection with let say persons. 我有一个可以说的人的收藏。 I get the collection like: 我得到像这样的集合:

_collection = _database.GetCollection<BsonDocument>('persons')`;

That gives me the collection and if I do: 这给了我收藏,如果我这样做:

_collection.AsQueryable();

It gives me the data. 它给了我数据。 All fine so far. 到目前为止一切都很好。

But Is there a way to get any info on the datatypes so the client can do his magic? 但是,是否有一种方法可以获取有关数据类型的任何信息,以便客户端可以发挥自己的魔力?

If i understand correctly you need to use typeof which will return a data type. 如果我正确理解,您需要使用typeof ,它将返回数据类型。 But there is a difference if you are working in BSON or JSON on terms of data types. 但是,如果您使用BSON或JSON处理数据类型,则会有所不同。 I would suggest you take a look at the docs on data types. 我建议您看一下有关数据类型的文档。 (Am on my cell so just search for it). (在我的手机上,只需搜索即可)。 Hope that helps 希望能有所帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM