2014-09-29 5 views
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

+0

puoi pubblicare un documento di esempio dalla tua raccolta? –

+3

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

risposta