My schema of users is like this:
{
name: String,
posts:[
{
title: String,
comments:[
{
country: String,
tags:[
{
title: String
}]
}]
}]
}
I want to push a tag into a specific comment of specific post.
I tried with this:
db.getCollection('users').update(
{"name" : "javier", "posts.title": "sometitle", "posts.comments.country": "ES"},
{$push:{"posts.$.comments.$.tags":{"title":"sometag"}}});
But mongoDB doesnt accept using two $. So how can I push the tag?, is it possible in mongoDB? Do I have bad concept of schemas? Thanks in advance.