发布网友 发布时间:2022-04-23 21:05
共1个回答
热心网友 时间:2022-05-05 21:40
example = {_id: "XXX", text: "YYY"}
db.example.aggregate([
{$project : {text : 1, length : {$size : "$text"}}},
{$sort : {length : 1}}
]);
I think this will do the job, but only for mongo 2.6 and above