MongoEngine/mongoengine — pull request #636 by ronaldvanrij (2014-05-06 11:53:52+00:00)
Title: Using the id field as shard key doesn't set the id of the Document when first created

Test case:
```
class Animal(Document):
name = StringField()
meta = {'shard_key': ('id', )}

dog = Animal()
dog.save()
dog.id == None
>> True
```
The item itself is in fact saved to MongoDB and does contain a valid id, however this id is not being set onto the MongoEngine Document when save() returns.
In the following example we're referencing the animals from their sharded collection using a ReferenceField. As such the animal's id is required to save the referencing Zoo Document:
```
class Zoo(Document):
animals = ListField(ReferenceField(Animal))
zoo = Zoo(animals=[dog])
zoo.save()
>> ValidationError: ValidationError (Zoo:None) (You can only reference documents once they have been saved to the database: ['animals'])
```