0
lodash a une fonction nommée keyby https://lodash.com/docs/4.17.4#keyBy comment obtenir le résultat comme ça?Comment recevoir le résultat en tant que "keyBy" d'un objet au lieu d'un tableau à partir d'une requête mongo?
const data = db.collection.find()
[
{ id: 'a', text: 'text' },
{ id: 'b', text: 'text' },
{ id: 'c', text: 'text' },
{ id: 'd', text: 'text' },
{ id: 'e', text: 'text' },
]
lodash.keyBy(data, 'id')
{
a: { id: 'a', text: 'text' },
b: { id: 'b', text: 'text' },
c: { id: 'c', text: 'text' },
d: { id: 'd', text: 'text' },
e: { id: 'e', text: 'text' },
}
cadre si l'agrégation ne peut pas le faire? Je dois tirer les disques d'abord puis keyby il – crapthings
@crapthings oui –