{"action":"created","issue":{"url":"https://api.github.com/repos/stedolan/jq/issues/862","labels_url":"https://api.github.com/repos/stedolan/jq/issues/862/labels{/name}","comments_url":"https://api.github.com/repos/stedolan/jq/issues/862/comments","events_url":"https://api.github.com/repos/stedolan/jq/issues/862/events","html_url":"https://github.com/stedolan/jq/issues/862","id":96514043,"number":862,"title":"Complex assignments bug","user":{"login":"chriskendrick","id":1453574,"avatar_url":"https://avatars.githubusercontent.com/u/1453574?v=3","gravatar_id":"","url":"https://api.github.com/users/chriskendrick","html_url":"https://github.com/chriskendrick","followers_url":"https://api.github.com/users/chriskendrick/followers","following_url":"https://api.github.com/users/chriskendrick/following{/other_user}","gists_url":"https://api.github.com/users/chriskendrick/gists{/gist_id}","starred_url":"https://api.github.com/users/chriskendrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chriskendrick/subscriptions","organizations_url":"https://api.github.com/users/chriskendrick/orgs","repos_url":"https://api.github.com/users/chriskendrick/repos","events_url":"https://api.github.com/users/chriskendrick/events{/privacy}","received_events_url":"https://api.github.com/users/chriskendrick/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-22T08:57:49Z","updated_at":"2015-07-22T16:36:08Z","closed_at":null,"body":"Looks like a bug to me\r\n\r\nThis works:\r\njq '(.posts[] | select(.author == \"stedolan\") | .comments) |= . + [\"terrible.\"]'<<<'{ \"posts\": [ { \"comments\": [\"legend\"], \"author\": \"Bradman\" }, { \"comments\": [\"rad\"], \"author\": \"Tesla\" }, { \"comments\": [\"okay\"], \"author\": \"stedolan\" } ] }'\r\n\r\nThis clearly doesn't work:\r\njq '(.posts | map(select(.author == \"stedolan\")) | .[].comments) |= . + [\"terrible.\"]'<<<'{ \"posts\": [ { \"comments\": [\"legend\"], \"author\": \"Bradman\" }, { \"comments\": [\"rad\"], \"author\": \"Tesla\" }, { \"comments\": [\"okay\"], \"author\": \"stedolan\" } ] }'\r\n\r\nTested on an up to date Amazon Linux distro from a git clone of the master branch of jq jq-1.5rc1-157-gf5a7bba 2015/07/22\r\n"},"comment":{"url":"https://api.github.com/repos/stedolan/jq/issues/comments/123782808","html_url":"https://github.com/stedolan/jq/issues/862#issuecomment-123782808","issue_url":"https://api.github.com/repos/stedolan/jq/issues/862","id":123782808,"user":{"login":"nicowilliams","id":604851,"avatar_url":"https://avatars.githubusercontent.com/u/604851?v=3","gravatar_id":"","url":"https://api.github.com/users/nicowilliams","html_url":"https://github.com/nicowilliams","followers_url":"https://api.github.com/users/nicowilliams/followers","following_url":"https://api.github.com/users/nicowilliams/following{/other_user}","gists_url":"https://api.github.com/users/nicowilliams/gists{/gist_id}","starred_url":"https://api.github.com/users/nicowilliams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nicowilliams/subscriptions","organizations_url":"https://api.github.com/users/nicowilliams/orgs","repos_url":"https://api.github.com/users/nicowilliams/repos","events_url":"https://api.github.com/users/nicowilliams/events{/privacy}","received_events_url":"https://api.github.com/users/nicowilliams/received_events","type":"User","site_admin":false},"created_at":"2015-07-22T16:36:08Z","updated_at":"2015-07-22T16:36:08Z","body":"The LHS of `|=` is supposed to be a path expression.  Not all\njq expressions make good path expressions, but `path` tries to make do.  I\ndon't see a way to fix this other than raising an error when the LHS is not\na path expression, but it's not clear how to determine that, either at\ncompile time or at run time...\n"}}