Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello All,
I have a need to add records to an array in a Mongo Collection arry_test2. I am able to do it seamlessly from my Mongoshell but when I am trying to do the same from tMongoDBRow, it is giving me an error code 59. Not sure if I am missing on any syntax options/switches. Please share your thoughts and observations.
Collection:
db.arry_test2.insert([
{
"id": "0001",
"type": "donut",
"name": "Cake",
"ppu": 0.55,
"batters":
{
"batter":
[
{ "id": "1001", "type": "Regular" },
{ "id": "1002", "type": "Chocolate" },
{ "id": "1003", "type": "Blueberry" },
{ "id": "1004", "type": "Dev's Food" }
]
},
"topping":
[
{ "id": "5001", "type": "None" },
{ "id": "5002", "type": "Glazed" },
{ "id": "5005", "type": "Sugar" },
{ "id": "5007", "type": "Powdered Sugar" },
{ "id": "5006", "type": "Chocolate with Sprinkles" },
{ "id": "5003", "type": "Chocolate" },
{ "id": "5004", "type": "Maple" }
]
} ]);
Command to update Document/ Insert records to Array, that works fine from MongoShell:
db.arry_test2.update({id:"0001"},{$addToSet:{"batters.batter":{'id':"100001",'type':"regular food"}}});
Please check the attached talend job snippet
Looks like Execute command is deprecated in version Mongo4.x, I was able to get over the issue using 'Construct command from a JSON string'... Thanks everyone
Any thoughts on this request please
Looks like Execute command is deprecated in version Mongo4.x, I was able to get over the issue using 'Construct command from a JSON string'... Thanks everyone
Hello,
Thanks for letting us know you have resolved this issue by yourself.
Best regards
Sabrina