Skip to content
Snippets Groups Projects
Commit 13a91ad4 authored by Inès Yeterian's avatar Inès Yeterian
Browse files

added error handling

parent 6c6f9deb
No related branches found
No related tags found
No related merge requests found
...@@ -15,6 +15,16 @@ var toucanSchema = new Schema ({ ...@@ -15,6 +15,16 @@ var toucanSchema = new Schema ({
toucanSchema.index({date:-1},{unique: true}); toucanSchema.index({date:-1},{unique: true});
var toucans = mongoose.model("Toucan",toucanSchema); var toucans = mongoose.model("Toucan",toucanSchema);
await toucans.updateMany( {},{$set: { toucan_id : 'example'} }, { multi: true }); try{
await toucans.updateMany( {},{$set: { toucan_id : 'example'} }, { multi: true }, function (err, docs) {
if (err){
console.log(err)
}
else{
console.log("Updated Docs : ", docs);
}
});
}
catch(e) { console.error(e) };
module.exports = toucans; module.exports = toucans;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment