{"action":"created","issue":{"url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/1177","repository_url":"https://api.github.com/repos/MongoEngine/mongoengine","labels_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/1177/labels{/name}","comments_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/1177/comments","events_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/1177/events","html_url":"https://github.com/MongoEngine/mongoengine/issues/1177","id":120053105,"number":1177,"title":"Cannot cast document to subclass","user":{"login":"manu-dikzit","id":3200279,"avatar_url":"https://avatars.githubusercontent.com/u/3200279?v=3","gravatar_id":"","url":"https://api.github.com/users/manu-dikzit","html_url":"https://github.com/manu-dikzit","followers_url":"https://api.github.com/users/manu-dikzit/followers","following_url":"https://api.github.com/users/manu-dikzit/following{/other_user}","gists_url":"https://api.github.com/users/manu-dikzit/gists{/gist_id}","starred_url":"https://api.github.com/users/manu-dikzit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manu-dikzit/subscriptions","organizations_url":"https://api.github.com/users/manu-dikzit/orgs","repos_url":"https://api.github.com/users/manu-dikzit/repos","events_url":"https://api.github.com/users/manu-dikzit/events{/privacy}","received_events_url":"https://api.github.com/users/manu-dikzit/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-02T22:45:41Z","updated_at":"2016-06-23T14:30:37Z","closed_at":null,"body":"I am using Flask + mongoengine to create a web application. Here is a part of my models\r\n\r\n    class Order(Document):\r\n        placed_on=DateTimeField(required=True)\r\n        order_id = SequenceField()\r\n        status = StringField(default=\"Request Received\")\r\n        cart = ListField(DictField())\r\n        userMobile = StringField(required=True)\r\n        userEmail = StringField(required=True)\r\n        address = ReferenceField(Address)\r\n        sheet_id = IntField(default=0)\r\n        remarks = StringField(default=\"\")\r\n\r\n        meta = {'allow_inheritance': True}\r\n\r\n    class ConfirmedOrder(Order):\r\n        delivery_slot_start = DateTimeField()\r\n        delivery_slot_end = DateTimeField()\r\n\r\n        meta = {'allow_inheritance': True}\r\nI have an instance of class Order as order. I now want to convert it to a ConfirmedOrder.This is the code I am using for the conversion\r\n\r\n    try:\r\n        order = Order.objects.get(id=order_id)\r\n        cOrder = ConfirmedOrder(**order.to_mongo())\r\n        cOrder.delivery_slot_start = timest\r\n        cOrder.delivery_slot_end = timend\r\n        cOrder.save();\r\n    except Exception as e:\r\n        print e\r\nI However, get this error:\r\n\r\nThe field '_id' does not exist on the document 'Order.ConfirmedOrder'"},"comment":{"url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/comments/228068283","html_url":"https://github.com/MongoEngine/mongoengine/issues/1177#issuecomment-228068283","issue_url":"https://api.github.com/repos/MongoEngine/mongoengine/issues/1177","id":228068283,"user":{"login":"amcgregor","id":76750,"avatar_url":"https://avatars.githubusercontent.com/u/76750?v=3","gravatar_id":"","url":"https://api.github.com/users/amcgregor","html_url":"https://github.com/amcgregor","followers_url":"https://api.github.com/users/amcgregor/followers","following_url":"https://api.github.com/users/amcgregor/following{/other_user}","gists_url":"https://api.github.com/users/amcgregor/gists{/gist_id}","starred_url":"https://api.github.com/users/amcgregor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amcgregor/subscriptions","organizations_url":"https://api.github.com/users/amcgregor/orgs","repos_url":"https://api.github.com/users/amcgregor/repos","events_url":"https://api.github.com/users/amcgregor/events{/privacy}","received_events_url":"https://api.github.com/users/amcgregor/received_events","type":"User","site_admin":false},"created_at":"2016-06-23T14:30:37Z","updated_at":"2016-06-23T14:30:37Z","body":"This is technically a duplicate of my now almost four year old ticket, #167."}}
{"actor":{"display_login":"amcgregor"}}