{"action":"created","issue":{"url":"https://api.github.com/repos/msavin/Mongol/issues/28","labels_url":"https://api.github.com/repos/msavin/Mongol/issues/28/labels{/name}","comments_url":"https://api.github.com/repos/msavin/Mongol/issues/28/comments","events_url":"https://api.github.com/repos/msavin/Mongol/issues/28/events","html_url":"https://github.com/msavin/Mongol/issues/28","id":59196570,"number":28,"title":"JSON circular structure error","user":{"login":"wallslide","id":917069,"avatar_url":"https://avatars.githubusercontent.com/u/917069?v=3","gravatar_id":"","url":"https://api.github.com/users/wallslide","html_url":"https://github.com/wallslide","followers_url":"https://api.github.com/users/wallslide/followers","following_url":"https://api.github.com/users/wallslide/following{/other_user}","gists_url":"https://api.github.com/users/wallslide/gists{/gist_id}","starred_url":"https://api.github.com/users/wallslide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wallslide/subscriptions","organizations_url":"https://api.github.com/users/wallslide/orgs","repos_url":"https://api.github.com/users/wallslide/repos","events_url":"https://api.github.com/users/wallslide/events{/privacy}","received_events_url":"https://api.github.com/users/wallslide/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-02-27T06:28:44Z","updated_at":"2015-02-27T12:56:04Z","closed_at":null,"body":"I get the following error when trying to use a collection of mine (Orders):\r\n```\r\nException in template helper: TypeError: Converting circular structure to JSON\r\n    at Object.stringify (native)\r\n    at String.Template.MongoInspector_documentViewer.helpers.documentJSON (http://0.0.0.0:3000/packages/msavin_mongol.js?558950870b2ec9c51c4caac919a2ca3b3e8b6a76:540:36)\r\n    at bindDataContext (http://0.0.0.0:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:2727:16)\r\n    at Blaze._wrapCatchingExceptions (http://0.0.0.0:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1606:16)\r\n    at Object.Spacebars.call (http://0.0.0.0:3000/packages/spacebars.js?7f53771c84a2eafac2b561c9796dda0d8af8e7f5:171:18)\r\n    at http://0.0.0.0:3000/packages/msavin_mongol.js?558950870b2ec9c51c4caac919a2ca3b3e8b6a76:467:24\r\n    at null.<anonymous> (http://0.0.0.0:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:2472:44)\r\n    at http://0.0.0.0:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1808:16\r\n    at Object.Blaze._withCurrentView (http://0.0.0.0:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:2043:12)\r\n    at viewAutorun (http://0.0.0.0:3000/packages/blaze.js?efa68f65e67544b5a05509804bf97e2c91ce75eb:1807:18)\r\n```\r\nAn instance of the Orders collection has an array in it like this:\r\n\r\n```javascript\r\n{\r\n    lineItems: []\r\n}\r\n```\r\nI use a transform function which puts a reference to the Order itself in each of the lineItems in that array. I either need a way to prevent Mongol from using transformed-objects, or a way to delete that reference before Mongol attempts to use the objects for display."},"comment":{"url":"https://api.github.com/repos/msavin/Mongol/issues/comments/76390329","html_url":"https://github.com/msavin/Mongol/issues/28#issuecomment-76390329","issue_url":"https://api.github.com/repos/msavin/Mongol/issues/28","id":76390329,"user":{"login":"JackAdams","id":1647779,"avatar_url":"https://avatars.githubusercontent.com/u/1647779?v=3","gravatar_id":"","url":"https://api.github.com/users/JackAdams","html_url":"https://github.com/JackAdams","followers_url":"https://api.github.com/users/JackAdams/followers","following_url":"https://api.github.com/users/JackAdams/following{/other_user}","gists_url":"https://api.github.com/users/JackAdams/gists{/gist_id}","starred_url":"https://api.github.com/users/JackAdams/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JackAdams/subscriptions","organizations_url":"https://api.github.com/users/JackAdams/orgs","repos_url":"https://api.github.com/users/JackAdams/repos","events_url":"https://api.github.com/users/JackAdams/events{/privacy}","received_events_url":"https://api.github.com/users/JackAdams/received_events","type":"User","site_admin":false},"created_at":"2015-02-27T12:56:04Z","updated_at":"2015-02-27T12:56:04Z","body":"JSON.stringify is the way that Mongol represents the data in html (using `pre` tags).  I can't think of a way to automatically detect circular references in a transformed document and remove them (because that's certainly what you'd have to do to get it to work).  If you've got a lightweight function that can do that, I can work it into a PR."}}