{"action":"opened","issue":{"url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/1366","repository_url":"https://api.github.com/repos/MongoEngine/mongoengine","labels_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/1366/labels{/name}","comments_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/1366/comments","events_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/1366/events","html_url":"https://github.com/MongoEngine/mongoengine/issues/1366","id":172084130,"number":1366,"title":"If didn't add primary_key=True to db.models, when update meet the  OperationError","user":{"login":"colynn","id":5203608,"avatar_url":"https://avatars.githubusercontent.com/u/5203608?v=3","gravatar_id":"","url":"https://api.github.com/users/colynn","html_url":"https://github.com/colynn","followers_url":"https://api.github.com/users/colynn/followers","following_url":"https://api.github.com/users/colynn/following{/other_user}","gists_url":"https://api.github.com/users/colynn/gists{/gist_id}","starred_url":"https://api.github.com/users/colynn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colynn/subscriptions","organizations_url":"https://api.github.com/users/colynn/orgs","repos_url":"https://api.github.com/users/colynn/repos","events_url":"https://api.github.com/users/colynn/events{/privacy}","received_events_url":"https://api.github.com/users/colynn/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-08-19T08:51:33Z","updated_at":"2016-08-19T08:51:33Z","closed_at":null,"body":"<pre>\r\n>>> Host.objects(_id=\"srv-example-test6\")[0].update(ip=\"1.1.1.1\")\r\nTraceback (most recent call last):\r\n  File \"<console>\", line 1, in <module>\r\n  File \"/usr/local/lib/python2.7/dist-packages/mongoengine/document.py\", line 474, in update\r\n    'attempt to update a document not yet saved')\r\nOperationError: attempt to update a document not yet saved\r\n>>> \r\n</pre>\r\n\r\nthe host collection defined as below:\r\n<pre>\r\nclass Host(Document):\r\n    _id = StringField(verbose_name=\"host name\", min_length=3, max_length=50, required=True, unique=True)\r\n    customer_id = StringField(required=True)\r\n    ip = StringField(max_length=255, required=True)\r\n    port = StringField(default=22, required=False)\r\n    server_lvm = BooleanField(default=False)\r\n    service = DictField(required=False)\r\n</pre>\r\n\r\ndocument example as below,\r\n> db.host.find({_id:\"srv-example-test6\"}).pretty()\r\n{\r\n\t\"_id\" : \"srv-example-test6\",\r\n\t\"customer_id\" : \"123\",\r\n\t\"ip\" : \"54.113.24.36\",\r\n\t\"port\" : \"40022\",\r\n\t\"server_lvm\" : true,\r\n\t\"service\" : {\r\n\t\t\"apache\" : {\r\n\t\t\t\"httpd_listening_port\" : \"80\",\r\n        ....\r\n}\r\n\r\n@michal-szostak"}}
{"actor":{"display_login":"colynn"}}