async function updateProfilePicture(newFileName) {
await connectDB();
try {
const userSchema = new mongoose.Schema({
name: String,
profilePic: String
});
const User = mongoose.model('User', userSchema,'users');
const res = await User.updateOne({name:"John"},{profilePic:`${newFileName}`})
console.log(res);
console.log("Updated");
} catch (error) {
console.error(error.message);
throw error;
}
}
async function updateProfilePicture(newFileName) {
await connectDB();
try {
const userSchema = new mongoose.Schema({
name: String,
profilePic: String
});
const User = mongoose.model('User', userSchema,'users');
const res = await User.updateOne({name:"John"},{profilePic:`${newFileName}`})
console.log(res);
console.log("Updated");
} catch (error) {
console.error(error.message);
throw error;
}
}