экспресс и; sequelize Преобразование круговой структуры в JSON

Also, if your password contains a percentage, %, 
 Because the percent ("%") character serves as the indicator for percent-encoded octets, it must be percent-encoded as "%25" for that octet to be used as data within a URI

for example, if your password is John%Doe, the new transformed password will be John%25Doe or
If password is Paul%20Wait, New Password will be Paul%2520Wait

mongoClient.connect("mongodb://username:John%25Doe@host:port/dbname", function(err, db) {
// password is John%Doe
    }`enter code here`
);
0
задан Sandra Willford 17 January 2019 в 09:35
поделиться

1 ответ

Поскольку map возвращает массив обещаний, поэтому я предлагаю вам использовать Promise.all для ожидания завершения всех обещаний.

const data  = Promise.all ( trips.map(trip => ({
    ...trip,
    milestones: async () => await Milestone.findAll({
        where: {
            trips_id: trip.id
        }
    }),
    vendor_charges: async () => await VendorCharge.findAll({
        where: {
            trips_id: trip.id
        }
    }),
    trip_notes: async () => await TripNote.findAll({
        where: {
            trips_id: trip.id
        }
    }),
    pieces: async () => await Pieces.findAll({
        where: {
            trips_id: trip.id
        }
    })
})) );


return await data;
0
ответ дан bereket gebredingle 17 January 2019 в 09:35
поделиться
Другие вопросы по тегам:

Похожие вопросы: