【发布时间】:2019-11-08 13:21:27
【问题描述】:
我们有一个在 robo mongo 中正确执行的 mongo 查询,用于查找 bigdecimal 值的列表,但我无法为其创建 java 代码。
我曾尝试通过使用 java 代码在 $in 运算符中使用 $numberDecimal,但它不起作用并出现此错误:
在 mongo 查询中,不能在 $in 下使用十进制数嵌套 $ 弹簧靴
所以我能够生成这种类型的查询,但它给了我错误:
db.getCollection("").aggregate({[
"$match": {
"$and" : [{ "xxx" :
{$in: [ { "$numberDecimal" : "1235.000"
} ] }} ]} ]})
这个正在工作:
db.getCollection("").aggregate({[
"$match": {
"$and" : [{ "xxx" :
{$in: [ { NumberDecimal("1235.000" )
} ] }} ]} ]})
【问题讨论】:
标签: java mongodb spring-boot