I am using django-nonrel and django-mongodb-engine
I have a Django model stored on PostgreSQL:
class Author(models.Model):
name = models.CharField(max_length=100)
created = models.DateTimeField(auto_now_add=True)
I have a MongoDB stored model:
class Post(models.Model):
title = models.CharField(max_length=100)
body = models.TextField()
created = models.DateTimeField(auto_now_add=True)
author = models.ForeignKey(Author)
Whenever I try to filter posts by author id:
posts = Post.objects.filter(author__id=1)
I get the following error:
/usr/local/lib/python2.6/dist-packages/bson/objectid.pyc in __validate(self, oid)
158 raise InvalidId("%s is not a valid ObjectId" % oid)
159 else:
--> 160 raise InvalidId("%s is not a valid ObjectId" % oid)
161 else:
162 raise TypeError("id must be an instance of (str, ObjectId), "
InvalidId: 1 is not a valid ObjectId
In [22]: Post.objects.filter(author__id=1)
Any ideas?