What I try to do is fairly simple, I have an array inside a document ;
\"tags\": [
{
\"t\" : \"architecture\",
\"n\" : 12
I don't believe this is possible to do in a single command.
MongoDB doesn't allow a $set (or $setOnInsert) and $inc to affect the same field in a single command.
You'll have to do one update command to attempt to $inc the field, and if that doesn't change any documents (n = 0), do the update to $set the field to it's default value.