From 5e729758235ae2c18d5fb9570efbb27e2d42c99c Mon Sep 17 00:00:00 2001 From: Tanzeel Pasha Date: Sat, 23 Nov 2024 18:41:25 +0530 Subject: [PATCH] Update listing.js To avoid the validation failed error during initializing the data from the dataset provided --- models/listing.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/models/listing.js b/models/listing.js index cc11890a..6b864903 100644 --- a/models/listing.js +++ b/models/listing.js @@ -8,13 +8,8 @@ const listingSchema = new Schema({ }, description: String, image: { - type: String, - default: - "https://images.unsplash.com/photo-1625505826533-5c80aca7d157?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTJ8fGdvYXxlbnwwfHwwfHx8MA%3D%3D&auto=format&fit=crop&w=800&q=60", - set: (v) => - v === "" - ? "https://images.unsplash.com/photo-1625505826533-5c80aca7d157?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxzZWFyY2h8MTJ8fGdvYXxlbnwwfHwwfHx8MA%3D%3D&auto=format&fit=crop&w=800&q=60" - : v, + filename: String, // You can store the filename as a string + url: String // You can store the URL as a string }, price: Number, location: String,