{"action":"created","issue":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/3400","labels_url":"https://api.github.com/repos/Automattic/mongoose/issues/3400/labels{/name}","comments_url":"https://api.github.com/repos/Automattic/mongoose/issues/3400/comments","events_url":"https://api.github.com/repos/Automattic/mongoose/issues/3400/events","html_url":"https://github.com/Automattic/mongoose/issues/3400","id":107868523,"number":3400,"title":"Want to Update Array of Array Object Value in Mongo","user":{"login":"Ashesh007","id":6592432,"avatar_url":"https://avatars.githubusercontent.com/u/6592432?v=3","gravatar_id":"","url":"https://api.github.com/users/Ashesh007","html_url":"https://github.com/Ashesh007","followers_url":"https://api.github.com/users/Ashesh007/followers","following_url":"https://api.github.com/users/Ashesh007/following{/other_user}","gists_url":"https://api.github.com/users/Ashesh007/gists{/gist_id}","starred_url":"https://api.github.com/users/Ashesh007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ashesh007/subscriptions","organizations_url":"https://api.github.com/users/Ashesh007/orgs","repos_url":"https://api.github.com/users/Ashesh007/repos","events_url":"https://api.github.com/users/Ashesh007/events{/privacy}","received_events_url":"https://api.github.com/users/Ashesh007/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-23T07:58:35Z","updated_at":"2015-09-24T16:46:07Z","closed_at":"2015-09-23T15:41:42Z","body":"\r\n    {\r\n    \"_id\": ObjectId(),\r\n    \"sku\": \"V4696-DR-V33\",\r\n    \"options\": [\r\n        {\r\n            \"sku\": \"8903689984338\",\r\n            \"stores\": [\r\n                {\r\n                    \"code\": \"AND1\",\r\n                    \"zipcode\": \"110070\",\r\n                    \"inventory\": -1000\r\n                },\r\n                {\r\n                    \"code\": \"AND2\",\r\n                    \"zipcode\": \"201010\",\r\n                    \"inventory\": -1000\r\n                },\r\n                {\r\n                    \"code\": \"AND3\",\r\n                    \"zipcode\": \"411001\",\r\n                    \"inventory\": -1000\r\n                },\r\n                {\r\n                    \"code\": \"AND4\",\r\n                    \"zipcode\": \" 700020\",\r\n                    \"inventory\": -1000\r\n                },\r\n                {\r\n                    \"code\": \"\",\r\n                    \"zipcode\": \"110015\",\r\n                    \"inventory\": -1000\r\n                }\r\n            ],\r\n            \"price\": 2199,\r\n            \"_id\": ObjectId(),\r\n            \"size\": \"14\"\r\n        },\r\n        {\r\n            \"sku\": \"1742564789\",\r\n            \"stores\": [\r\n                {\r\n                    \"code\": \"AND5\",\r\n                    \"zipcode\": \"110070\",\r\n                    \"inventory\": -1000\r\n                },\r\n                {\r\n                    \"code\": \"AND6\",\r\n                    \"zipcode\": \"201010\",\r\n                    \"inventory\": -1000\r\n                },\r\n                {\r\n                    \"code\": \"AND7\",\r\n                    \"zipcode\": \"411001\",\r\n                    \"inventory\": -1000\r\n                },\r\n                {\r\n                    \"code\": \"AND8\",\r\n                    \"zipcode\": \" 700020\",\r\n                    \"inventory\": -1000\r\n                },\r\n                {\r\n                    \"code\": \"\",\r\n                    \"zipcode\": \"110015\",\r\n                    \"inventory\": -1000\r\n                }\r\n            ],\r\n            \"price\": 2199,\r\n            \"_id\": ObjectId(),\r\n            \"size\": \"14\"\r\n        },\r\n\r\n    ]\r\n    }\r\n\r\nI want to update each inventory value. I want query in mongo query or any python script to update whole document with nested value. Can I use $unwind method for resolve this issue ??? I want Mongo query related to this issue? Kindly Reply this issue ?? I am very Stuck with This Issue"},"comment":{"url":"https://api.github.com/repos/Automattic/mongoose/issues/comments/142984136","html_url":"https://github.com/Automattic/mongoose/issues/3400#issuecomment-142984136","issue_url":"https://api.github.com/repos/Automattic/mongoose/issues/3400","id":142984136,"user":{"login":"vkarpov15","id":1620265,"avatar_url":"https://avatars.githubusercontent.com/u/1620265?v=3","gravatar_id":"","url":"https://api.github.com/users/vkarpov15","html_url":"https://github.com/vkarpov15","followers_url":"https://api.github.com/users/vkarpov15/followers","following_url":"https://api.github.com/users/vkarpov15/following{/other_user}","gists_url":"https://api.github.com/users/vkarpov15/gists{/gist_id}","starred_url":"https://api.github.com/users/vkarpov15/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkarpov15/subscriptions","organizations_url":"https://api.github.com/users/vkarpov15/orgs","repos_url":"https://api.github.com/users/vkarpov15/repos","events_url":"https://api.github.com/users/vkarpov15/events{/privacy}","received_events_url":"https://api.github.com/users/vkarpov15/received_events","type":"User","site_admin":false},"created_at":"2015-09-24T16:46:07Z","updated_at":"2015-09-24T16:46:07Z","body":"The simplest way IMO would be to just do a script that loads the documents in batches and then updates them. Doing it with the aggregation framework would be confusing and cumbersome, as well as error prone because you'd have to do a very messy `$project`."}}