FAQ-过滤条件指定日期函数报错
更新时间: 2024-03-11 02:50:56
阅读 1719
问题描述
问题描述/异常栈
org.bson.json.JsonParseException: Invalid JSON number
at org.bson.json.JsonScanner.scanNumber(JsonScanner.java:430)
at org.bson.json.JsonScanner.nextToken(JsonScanner.java:93)
at org.bson.json.JsonReader.popToken(JsonReader.java:492)
at org.bson.json.JsonReader.readBsonType(JsonReader.java:255)
at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:149)
at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:45)
at org.bson.codecs.configuration.LazyCodec.decode(LazyCodec.java:47)
at org.bson.codecs.DocumentCodec.readValue(DocumentCodec.java:222)
at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:151)
at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:45)
at org.bson.codecs.DocumentCodec.readValue(DocumentCodec.java:222)
at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:151)
at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:45)
at org.bson.Document.parse(Document.java:109)
at org.bson.Document.parse(Document.java:94)
at com.netease.music.da.transfer.mongodb.reader.MongodbReader.doRead(MongodbReader.scala:41)
或
org.bson.json.JsonParseException: JSON reader expected an integer or a string but found 'ISODate'.
at org.bson.json.JsonReader.visitDateTimeConstructor(JsonReader.java:923)
at org.bson.json.JsonReader.visitNew(JsonReader.java:554)
at org.bson.json.JsonReader.readBsonType(JsonReader.java:241)
at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:149)
at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:45)
at org.bson.codecs.configuration.LazyCodec.decode(LazyCodec.java:47)
at org.bson.codecs.DocumentCodec.readValue(DocumentCodec.java:222)
at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:151)
at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:45)
at org.bson.codecs.DocumentCodec.readValue(DocumentCodec.java:222)
at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:151)
at org.bson.codecs.DocumentCodec.decode(DocumentCodec.java:45)
at org.bson.Document.parse(Document.java:109)
at org.bson.Document.parse(Document.java:94)
at com.netease.music.da.transfer.mongodb.reader.MongodbReader.doRead(MongodbReader.scala:32)
解决方案
解决方法:
1. 过滤条件中的ISODate().getTime()-60*60*1000 使用参数替换,如使用a替换,{'time':{$lt: new Date('${a} CST')}}
2. 在节点属性配置时间参数a的值
a $(new("org.joda.time.DateTime", ${schedule.exec.time}).minusHours(1).toString('EEE MMM dd yyyy HH:mm:ss'))
问题原因
作者:常惠渊
文档反馈
以上内容对您是否有帮助?