Is there a floor function in Mongodb aggregation framework?(Mongodb聚合框架中是否有地板功能?)
问题描述
我尝试在 mongodb 中进行一些整数数学运算,但遇到了一些问题.有没有办法在 mongo db 聚合框架中向上或向下舍入双精度数?
I try to do some integer math in mongodb and have some problems. Is there a way to round doubles up or down in the mongo db aggregation framework?
推荐答案
根据 Stennie 的评论,不支持 floor 和 ceiling 方法.
As per the comment from Stennie, the floor and ceiling methods are not supported.
根据我上面的评论,我能找到的最佳解决方案就是执行如下所示的操作: (num-mod(num,1)) 应该产生与 floor 函数相同的结果.
And as per my comment above, the best solution that I could find was just doing an operation that looks like: (num-mod(num,1)) which should yield the same result as the floor function.
这篇关于Mongodb聚合框架中是否有地板功能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Mongodb聚合框架中是否有地板功能?
基础教程推荐
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
