org.bson.BSONObject中的java类型 [英] java types in org.bson.BSONObject

查看:1673
本文介绍了org.bson.BSONObject中的java类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习用于mongodb的BSON java库和我'我试图将 org.bson.BSONObject 转换为XML,以便使用 XSLT 样式表对其进行转换。

I'm currently learning the BSON java library for mongodb and I'm trying to transform a org.bson.BSONObject into XML in order to transform it with a XSLT stylesheet.

我可以在Mongodb的BSONObject中找到哪种类型的Java类型?当然会有:

What kind of java types can I find as values in a BSONObject from a Mongodb ? Of course there will be:


  • BSONObject(内部文档)

  • java.lang.String

  • ???

其他是什么? BigDecimal和BigInteger? boolean,int,long,double?时间戳..等等...... ??

what are the others ? BigDecimal and BigInteger ? boolean, int, long, double ? Timestamp.. etc... ??

谢谢,

Pierre

推荐答案

还必须搜索它,但根据 mongodb-dev帖子映射完成如下:

Had to search for it too, but according to this mongodb-dev post mapping is done like this:

 NULL            null
 UNDEFINED       null
 BOOLEAN         Boolean
 NUMBER          Double
 NUMBER_INT      Integer
 NUMBER_LONG     Long
 SYMBOL          String
 STRING          String
 OID             mongodb ObjectID
 REF             DBPointer
 DATE            Date
 REGEX           Pattern
 BINARY          DBBinary
 CODE            (exception)
 ARRAY           DBList
 OBJECT          DBObject or DBRef
 TIMESTAMP       DBTimestamp
 MINKEY          String: "MinKey"
 MAXKEY          String: "MaxKey" 

关于mongodb.org的这篇文章也是一个很好的资源。

This article on mongodb.org is a good resource for it, too.

编辑:看一下源:org.bson.types。*有很多BSON类型的类。 org.bson.BSONDecoder正在解码BSON字符串并执行上面列出的映射。

Had a look at the source: org.bson.types.* is having a number of classes for BSON types. org.bson.BSONDecoder is decoding a BSON string and does the mapping listed above.

这篇关于org.bson.BSONObject中的java类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆