{"action":"created","issue":{"url":"https://api.github.com/repos/zakird/celerybeat-mongo/issues/11","labels_url":"https://api.github.com/repos/zakird/celerybeat-mongo/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/zakird/celerybeat-mongo/issues/11/comments","events_url":"https://api.github.com/repos/zakird/celerybeat-mongo/issues/11/events","html_url":"https://github.com/zakird/celerybeat-mongo/issues/11","id":55692029,"number":11,"title":"Duplicate key error - null key","user":{"login":"alexandre","id":5252795,"avatar_url":"https://avatars.githubusercontent.com/u/5252795?v=3","gravatar_id":"","url":"https://api.github.com/users/alexandre","html_url":"https://github.com/alexandre","followers_url":"https://api.github.com/users/alexandre/followers","following_url":"https://api.github.com/users/alexandre/following{/other_user}","gists_url":"https://api.github.com/users/alexandre/gists{/gist_id}","starred_url":"https://api.github.com/users/alexandre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexandre/subscriptions","organizations_url":"https://api.github.com/users/alexandre/orgs","repos_url":"https://api.github.com/users/alexandre/repos","events_url":"https://api.github.com/users/alexandre/events{/privacy}","received_events_url":"https://api.github.com/users/alexandre/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/zakird/celerybeat-mongo/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-27T23:37:14Z","updated_at":"2015-05-01T19:10:01Z","closed_at":"2015-05-01T15:14:41Z","body":"Hi guys, look at this error:\r\n```\r\nbeat raised exception <class 'mongoengine.errors.NotUniqueError'>: NotUniqueError('Tried to save duplicate unique keys (insertDocument :: caused by :: 11000 E11000 duplicate key error index: heroku_app25944079.schedules.$name_1  dup key: { : null })',)\r\n```\r\nSituation:\r\n\r\nEverytime that I restart celerybeat,  a document with an empty name is created. Even when I delete it. It has just the \"total_run\" and \"last_run_at\" attributes.\r\n\r\nSometimes I'm trying save a new task in the database and I get a duplicate unique keys error. I'm certain that my tasks do not have duplicate names:\r\n\r\n``` python\r\n# how I create my tasks name\r\nperiodic_task = celerybeatmongo.models.PeriodicTask(\r\n        name='verify_tml_delay_{}'.format(datetime.datetime.now().isoformat()),\r\n        ....\r\n```\r\n\r\nThe weirdest thing is the document with empty data... perhaps it is related to the duplicate names?\r\n\r\nAny guidance or suggestion will be of extreme value: i have been stuck with this for hours! \r\n\r\nMany thanks in advance!\r\n\r\nCheers,\r\n"},"comment":{"url":"https://api.github.com/repos/zakird/celerybeat-mongo/issues/comments/98208305","html_url":"https://github.com/zakird/celerybeat-mongo/issues/11#issuecomment-98208305","issue_url":"https://api.github.com/repos/zakird/celerybeat-mongo/issues/11","id":98208305,"user":{"login":"zakird","id":201296,"avatar_url":"https://avatars.githubusercontent.com/u/201296?v=3","gravatar_id":"","url":"https://api.github.com/users/zakird","html_url":"https://github.com/zakird","followers_url":"https://api.github.com/users/zakird/followers","following_url":"https://api.github.com/users/zakird/following{/other_user}","gists_url":"https://api.github.com/users/zakird/gists{/gist_id}","starred_url":"https://api.github.com/users/zakird/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zakird/subscriptions","organizations_url":"https://api.github.com/users/zakird/orgs","repos_url":"https://api.github.com/users/zakird/repos","events_url":"https://api.github.com/users/zakird/events{/privacy}","received_events_url":"https://api.github.com/users/zakird/received_events","type":"User","site_admin":false},"created_at":"2015-05-01T19:10:01Z","updated_at":"2015-05-01T19:10:01Z","body":"If there is a bug with the celerybeat-mongo library itself, I'm happy to\nreopen the ticket.\n\nOn Fri, May 1, 2015 at 3:08 PM, Zakir Durumeric <zakird@gmail.com> wrote:\n\n> So there isn't _any_ code in celerybeat-mongo that touches name. The\n> library simply provides a mongoengine model. I closed the issue because\n> it's not based on the code in this library.\n>\n> Either this is an issue with your format statement, or you are creating\n> the mongoengine document incorrectly. The error clearly states that the\n> duplicate value is the NULL value. You need to look at why the mongoengine\n> model you created is getting a NULL value. Unless mongoengine or mongodb is\n> broken, you ARE creating tasks with duplicate names. One thing that jumps\n> out immediately is I don't know why you are passing names into the\n> constructor of the document. I don't know whether this is supported\n>\n> On Fri, May 1, 2015 at 1:24 PM, Alexandre <notifications@github.com>\n> wrote:\n>\n>> @zakird <https://github.com/zakird> ,\n>>\n>> I'm sorry man, but that's \"Captain Obvious\" answer. I'm my text, I said:\n>>\n>> *Sometimes I'm trying save a new task in the database and I get a\n>> duplicate unique keys error. I'm certain that my tasks do not have\n>> duplicate names*\n>>\n>> Is possible the celerybeat-mongo creates a null named task?\n>>\n>> Thanks for your effort.\n>>\n>> P.S IMHO, it's really weird you close a issue based on an idea that is\n>> not from the OP.\n>>\n>> —\n>> Reply to this email directly or view it on GitHub\n>> <https://github.com/zakird/celerybeat-mongo/issues/11#issuecomment-98182372>\n>> .\n>>\n>\n>\n"}}