解决MongoDB读数据报异常readEndDocument can only be called when State is END_OF_DOCUMENT
来源:互联网 发布:湖北卓腾网络 编辑:程序博客网 时间:2024/06/05 08:32
org.bson.BsonInvalidOperationException: readEndDocument can only be called when State is END_OF_DOCUMENT, not when State is NAME. at org.bson.AbstractBsonReader.throwInvalidState(AbstractBsonReader.java:671) at org.bson.AbstractBsonReader.readEndDocument(AbstractBsonReader.java:357) at com.jianmi.cloud.mongo.content.SmsContentCodec.decode(SmsContentCodec.java:42) at com.jianmi.cloud.mongo.content.SmsContentCodec.decode(SmsContentCodec.java:16) at com.mongodb.operation.CommandResultArrayCodec.decode(CommandResultArrayCodec.java:52) at com.mongodb.operation.CommandResultDocumentCodec.readValue(CommandResultDocumentCodec.java:53) at org.bson.codecs.BsonDocumentCodec.decode(BsonDocumentCodec.java:84) at org.bson.codecs.BsonDocumentCodec.decode(BsonDocumentCodec.java:41)
public SmsContentEntity decode(BsonReader reader, DecoderContext decoderContext) { SmsContentEntity user = new SmsContentEntity(); reader.readStartDocument(); user.setId(reader.readObjectId("_id").toString()); user.setAccount(reader.readString("account")); //用户名 user.setContent(reader.readString("content")); //内容 //因为多了一些字段不读取,这里都跳过一下 while (reader.readBsonType() != BsonType.END_OF_DOCUMENT) { System.out.println("reader.readName:"+reader.readName()); reader.skipValue(); } reader.readEndDocument(); return user; }
阅读全文
0 0
- 解决MongoDB读数据报异常readEndDocument can only be called when State is END_OF_DOCUMENT
- 报RegisterForEventValidation can only be called during Render()错误
- Error: Finish can only be called once
- Unity3d报奇怪的错误CompareBaseObjectsInternal can only be called from the main thread.
- Unity3d报奇怪的错误CompareBaseObjectsInternal can only be called from the main thread.
- unity报“GetLocalizedString can only be called from the main thread.”错误。
- 学习AJAX Toolskit之解决故障:RegisterDataItem can only be called during an async postback.
- ERROR 1840 (HY000) at line 24: GTID_PURGED can only be set when GTID_EXECUTED is empty.
- iOS报错 -pie can only be used when targeting iOS 4.2 or later
- -pie can only be used when targeting iOS 4.2 or later错误解决
- 导出excel RegisterForEventValidation can only be called during Render();
- Error: CompareBaseObjectsInternal can only be called from the main thread
- unity DestroyBuffer can only be called from the main thread
- get_isPlaying can only be called from the main thread unity3d
- Only one expression can be specified in the select list when the subquery is not introduced with(求助)
- Only one expression can be specified in the select list when the subquery is not introduced with EXI
- 'Push segues can only be used when the source controller is managed by an instance of UINavigationC
- ERROR 1840 (HY000) at line 24: @@GLOBAL.GTID_PURGED can only be set when @@GLOBAL.GTID_EXECUTED is e
- android_本地播放器
- 牛客网剑指offer-重建二叉树
- 求n个数的最值
- Unity3D Shader 入门
- 并查集
- 解决MongoDB读数据报异常readEndDocument can only be called when State is END_OF_DOCUMENT
- 逃离迷宫 搜索总结
- 深入TCP(一)--TCP报文段首部分析
- POJ
- PLSQL高级查询--ʒbθ图书馆
- Python学习笔记(1)配置环境
- flume的普通配置
- C语言实现寻找合法帧
- Java赋值表达式的值