Answers for "mongodb mongoose update convert string to object"

0

mongodb mongoose update convert string to object

const media = await Media.find({});
            media.forEach(async (item) => {
            const update = await Media.findOneAndUpdate(
                    { _id: item._id },
                    { user: mongoose.Types.ObjectId(item.user) },
                    { upsert: true }
                );
            });```
Posted by: Guest on March-18-2021

Browse Popular Code Answers by Language