Mongodb聚合框架中是否有底层函数? [英] 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的评论,不支持地板和天花板方法。
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聚合框架中是否有底层函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文