相关疑难解决方法(0)

mongoDB中的字符串字段值长度

字段的数据类型是String.我想获取字段名称的字符长度大于40的数据.

我尝试了这些查询但返回错误.1.

db.usercollection.find(
{$where: "(this.name.length > 40)"}
).limit(2);

output :error: {
    "$err" : "TypeError: Cannot read property 'length' of undefined near '40)' ",
    "code" : 16722
}
Run Code Online (Sandbox Code Playgroud)

这是在2.4.9但我的版本是2.6.5

field string-length mongodb

61
推荐指数
5
解决办法
8万
查看次数

标签 统计

field ×1

mongodb ×1

string-length ×1