I am using sails js with mongodb.
here is my EventTags model:
EventTags.js
module.exports = {
schema: true,
attributes: {
eventList: {
collection: 'Events',
via:'tagList'
},
event_tag_name:{ type:'string',
required:true,
unique:true
}
}
};
here is my Events Model:
Events.js
module.exports = {
schema: true,
attributes: {
tagList: {
collection: 'EventTags',
via:'eventList'
},
title:{ type:'string',required: true},
blurb:{ type:'string'},
description:{ type:'string'},
venue: {type: 'string',required: true},
}
};
created the EventTags and here is my json response.
{
"status": 109,
"status_message": "success..!!",
"event_tag_info": {
"event_tag_name": "travel1",
"createdAt": "2015-07-15T06:01:09.050Z",
"updatedAt": "2015-07-15T06:01:09.050Z",
"id": "55a5f725f7d707ba4f32ac74"
}
}
next i copied the EventTags ID i.e."id": "55a5f725f7d707ba4f32ac74" . to Events Model. here is Events Model Post Data.
{
"tagList":"55a5f725f7d707ba4f32ac74",
"title": "Snow City : Bengaluru",
"blurb": "testtesttesttesttesttest",
"description": "Toronto has been chosene city",
"venue": "palace ground"
}
when i hit http://localhost:1337/events
I am getting empty tagList array.
[
{
tagList: [ ],
title: "Snow City ",
blurb: "some data",
description: "some data",
venue: "some address",
id: "55a5f98ef7d707ba4f32ac75"
}
]
Please Can Anyone Help Me With This.