阵列顺序的蒙古式顺序 [英] Mongoid order by length of array

查看:65
本文介绍了阵列顺序的蒙古式顺序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何根据作为模型内部字段的数组的长度对Mongoid模型进行排序.

How to sort the Mongoid model by the length of the array which is a field inside the model.

推荐答案

文档显示您无法使用尺寸进行订购.

Document says that you can't orderby using size.

尝试添加一个包含size值的新列,并对其进行排序,以便按顺序进行操作.

Try adding a new column containing the value of size and sort it which will work as order by.

这篇关于阵列顺序的蒙古式顺序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆