Object as key in map mongoose is not storing

Viewed 23

I want to store map to db but it's not working when I add object as a key

const ChatSchema = new Schema({
    chat: Map
})

const Chat = mongoose.model("Chat", ChatSchema)

const chats = new Map([[
    {name: "Nina"}, [{ name: "Umar", msg: "Hey Sup" }, { name: "Umar", msg: "I'm good, wbu?" }],
]])

console.log(c)

Output: { _id: 6115c9d47f76262114e35c1e }

Any ideas?

0 Answers
Related