ighack 发表于 2019-01-21 15:02

在mongodb怎么写substr(substr(a,1,8),1,4)

{ "$project" : { "ss" : "$movieId", "dd" : "$title", "t" : { "$substr" : [{ "SUBSTR_fa81ecc633086358d21e299e466533bb" : { "$substr" : ["genres", 1, 8] } }, 1, 6] } } }上面是我用java生成的代码
但是出错了提示
com.mongodb.MongoCommandException: Command failed with error 16007 (Location16007): 'can't convert from BSON type object to String' on server 10.3.87.54:27017. The full response is { "ok" : 0.0, "errmsg" : "can't convert from BSON type object to String", "code" : 16007, "codeName" : "Location16007" }



页: [1]
查看完整版本: 在mongodb怎么写substr(substr(a,1,8),1,4)