I have a form on my express app for users to fill out, and it gets inserted into mongoDB through mongoose. One of the inputs is for a URL. When I save the new model to mongoDB, a url that looked like this https://www.youtube.com/ now looks like this https:&# x2F;&# x2F;www.youtube.com& #x2F;.(without the spaces)
I've come across this question: How to store URL value in Mongoose Schema? but I'm not looking to validate, I just want to be able to save URL as plain text
let ProductSchema = new Schema({
business: {type: String, required: true},
productName: {type: String, required: true},
category: {type: String, required: true},
price: {type: Number, required: true },
description: {type: String, required: true},
websiteURL: {type: String, required: true},
// websiteURL: {type: Url, required: true}, why isn't this possible?
});