Click here to Skip to main content
15,886,774 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Please help.

I am using mongoose, mongodb and node.js

I am trying to save data array object. But, in mongodb the field always empty.
My field in mongodb is "tag"

It should be contain data like :

JavaScript
[
{tag_title: "Art", _tagId: "5f8d0b32f7074616e46cf923"}, 
{tag_title: "Artistic", _tagId: "5f8d0b32f7074616e46cf875"}
]


My codes : cl - Pastebin.com[^]

I have tried this solution: Mongoose ODM[^] but not work.

What I have tried:

Set mongoose schema to:
tag: [{
    tag_title: {
        type: String,
    },
    _tagId: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'Tag'
    }
}],
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900