{"action":"created","issue":{"url":"https://api.github.com/repos/substance/archivist/issues/62","labels_url":"https://api.github.com/repos/substance/archivist/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/substance/archivist/issues/62/comments","events_url":"https://api.github.com/repos/substance/archivist/issues/62/events","html_url":"https://github.com/substance/archivist/issues/62","id":55312280,"number":62,"title":"Implicit maintanance mode","user":{"login":"michael","id":2931,"avatar_url":"https://avatars.githubusercontent.com/u/2931?v=3","gravatar_id":"","url":"https://api.github.com/users/michael","html_url":"https://github.com/michael","followers_url":"https://api.github.com/users/michael/followers","following_url":"https://api.github.com/users/michael/following{/other_user}","gists_url":"https://api.github.com/users/michael/gists{/gist_id}","starred_url":"https://api.github.com/users/michael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michael/subscriptions","organizations_url":"https://api.github.com/users/michael/orgs","repos_url":"https://api.github.com/users/michael/repos","events_url":"https://api.github.com/users/michael/events{/privacy}","received_events_url":"https://api.github.com/users/michael/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/substance/archivist/milestones/1","labels_url":"https://api.github.com/repos/substance/archivist/milestones/1/labels","id":938636,"number":1,"title":"January Alpha","description":"First alpha release should be ready to use for editors.","creator":{"login":"michael","id":2931,"avatar_url":"https://avatars.githubusercontent.com/u/2931?v=3","gravatar_id":"","url":"https://api.github.com/users/michael","html_url":"https://github.com/michael","followers_url":"https://api.github.com/users/michael/followers","following_url":"https://api.github.com/users/michael/following{/other_user}","gists_url":"https://api.github.com/users/michael/gists{/gist_id}","starred_url":"https://api.github.com/users/michael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michael/subscriptions","organizations_url":"https://api.github.com/users/michael/orgs","repos_url":"https://api.github.com/users/michael/repos","events_url":"https://api.github.com/users/michael/events{/privacy}","received_events_url":"https://api.github.com/users/michael/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":14,"state":"open","created_at":"2015-01-16T14:25:30Z","updated_at":"2015-01-26T20:26:46Z","due_on":"2015-01-30T23:00:00Z","closed_at":null},"comments":23,"created_at":"2015-01-23T18:02:25Z","updated_at":"2015-01-27T13:14:04Z","closed_at":null,"body":"While working on the jstree-based subject manager I had some ideas how we can make the maintenance mode implicit, so we don't have do so many actions for doing simple updates.\r\n\r\nFirst of all, most options don't touch any documents so they don't require a maintenance mode. Those are:\r\n\r\n- move subject\r\n- create subject\r\n- rename subject\r\n\r\nSo you will be able to perform those actions any time without extra action. \r\n\r\nNow how to go about the destructive actions:\r\n\r\n- delete subject\r\n- merge subject\r\n\r\nWhen user clicks 'delete' or 'merge into' we do the following:\r\n\r\n- tell the user that this is a heavy action, that may take a while to complete and while it's running it will interrupt the writing process of editors (=maintenance mode).\r\n- if the user confirms the services mergeSubject/deleteSubject will turn maintenance mode on automatically and turn it off again after the operation has been completed. \r\n- turning on maintenance mode implicitly creates a backup first, so if during our massive operation something goes wrong we can restore the state from before turn off maintenance mode again but let the user know the operation was not applied.\r\n\r\nThis requires some smartness on the server side but I think it's the best possible solution because it doesn't add anything extra to the user interface, and also it's secure. what we get here is a safe transaction mechanism:\r\n\r\n- turn maintenance mode on (start transation)\r\n- make batch updates\r\n- turn maintenance mode off (commit transaction when no errors, rollback transaction when there was an error)"},"comment":{"url":"https://api.github.com/repos/substance/archivist/issues/comments/71645492","html_url":"https://github.com/substance/archivist/issues/62#issuecomment-71645492","issue_url":"https://api.github.com/repos/substance/archivist/issues/62","id":71645492,"user":{"login":"michael","id":2931,"avatar_url":"https://avatars.githubusercontent.com/u/2931?v=3","gravatar_id":"","url":"https://api.github.com/users/michael","html_url":"https://github.com/michael","followers_url":"https://api.github.com/users/michael/followers","following_url":"https://api.github.com/users/michael/following{/other_user}","gists_url":"https://api.github.com/users/michael/gists{/gist_id}","starred_url":"https://api.github.com/users/michael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michael/subscriptions","organizations_url":"https://api.github.com/users/michael/orgs","repos_url":"https://api.github.com/users/michael/repos","events_url":"https://api.github.com/users/michael/events{/privacy}","received_events_url":"https://api.github.com/users/michael/received_events","type":"User","site_admin":false},"created_at":"2015-01-27T13:14:04Z","updated_at":"2015-01-27T13:14:04Z","body":"that's so nice of you. :) So yeah we can split work a bit. Essentially what I need is a db.backupDocuments() method as well as a db.restoreDocuments() method. :) So if you could do that for me I will make the rest and test.\r\n\r\nI'd be curious how you will do it, because it seems that using some native mongo API would be the easiest. Mongoose has everything tied to schema definitions that belong to one collections, which makes things a bit harder to access. I was wondering if the document schema could just be reused, so you could save on the model but telling that it should use a different collection. Hm... or you have to create a copy of the schema and call it DocumentBackup?"}}