6
db.test.aggregate({
$match : { "themType" : "SuperTest" , "mType" : { "$in" : [ 1 , 2]}}
},
{ $project : { "_id" : 1, "refTestId" : 1, "avatar" : { $concat : [$refTestId] }
} });
e avatar restituisce null, probabilmente è perché il suo objectId, è possibile in questa query effettuare da questa stringa objectId?progetto di aggregazione mongodb objectId con concat
puoi pubblicare un documento di esempio dalla tua raccolta? –
Non penso che possiamo aiutarti completamente se non riesci a chiarire completamente il problema. '$ concat' è un operatore per stringhe; non funzionerà con altri tipi. – wdberkeley