简体   繁体   中英

mongodb aggregation project objectId with concat

db.test.aggregate({
    $match : { "themType" : "SuperTest" , "mType" : { "$in" : [ 1 , 2]}}
}, 
{ $project : { "_id" : 1, "refTestId" : 1, "avatar" : { $concat : [$refTestId] }
  } });

and avatar returns me null, probably its because its objectId, is it possible in this query to make from this objectId string ?

This isn't possible yet. WiP issue see: https://jira.mongodb.org/browse/SERVER-29512

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM