Mongodb聚合框架中是否有地板功能?

编程入门 行业动态 更新时间:2024-10-26 20:28:25
本文介绍了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聚合框架中是否有地板功能?

本文发布于:2023-11-22 12:58:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1617502.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:框架   地板   功能   Mongodb

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!