I seem to have encountered roadblock when using MongoDB and would like to know if all this is around it without changing my database structure. Now my database structure is as follows:
Company=
{
_id:1,
properties:[
{
property_id: 1
tags : [
{
tag_id: 1
tag_value: 1000
channels: [
{
channel_id:1
channel_name:"test1"
},
{
channel_id:2
channel_name:"test2"
}]
},
{
tag_id:2
tag_value: 2500
channels: [
{
channel_id:2
channel_name:"test2"
},
{
channel_id:3
channel_name:"test3"
}]
}]
},
{
property_id: 2
tags : [
{
tag_id: 3
tag_value: 500
channels: [
{
channel_id:1
channel_name:"test1"
},
{
channel_id:3
channel_name:"test3"
}]
},
{
tag_id: 4
tag_value: 5000
channels: [
{
channel_id:1
channel_name:"test1"
}]
}]
}]
}
I am having a problem where I cannot find a way to update certain tags in a property. For example, I want to change the value of tag_id 4 in property 2 to 100. Or I want to add a channel to the channel array in tag_id 3.
I would like to do something similar to this:
db.company.update({_id:1, "properties.property_id":2, "tags.tag_id":4}, {"properties.$.tags.$.tag_value":100});
, MongoDB, JIRA. , , . , properties.1.tags.0, , .
, , .