I am looking for a solution to store objects containing text formatting methods and CSS styles in a MongoDB collection using Mongoose. The structure of the objects I have is more complex than this example:
const myStyle = {
book: {
templates: ["/authors/. ", "/title/. ", "/date/. "],
authors: {
format: formatAuthors
},
title: {
format: formatTitle,
style: {fontStyle: "italic"}
}
}
}
Does anyone have suggestions on how to send and save such objects in a MongoDB collection? It seems that Object cannot be used as a schemaType according to the Mongoose documentation, making it challenging to save them directly as JavaScript objects.