Hallöchen,

some non-relational databases (e.g. MongoDB) have support for arbitrarily nested objects. To make queries that "reach" into these sub-objects, the Django-nonrel developers find it appealing to use JOIN syntax. For instance, if you had this person in your database

  {'name': 'Bob', 'address': {'city': 'NY', 'street': 'Wall Street 42'}}

you could find Bob using these queries:

  Person.objects.filter(name='Bob')
  Person.objects.filter(address__city='NY')
  Person.objects.filter(address__street__startswith='Wall')
  ...

Similarly, sub-objects may be stored in a list, like so:

  {
    'votes': [
      {'voter': 'Bob', 'vote': 42},
      {'voter': 'Ann', 'vote': 3.14}}
    ]
  }

  Vote.objects.filter(votes__vote__gt=2)
  ...


These sub-object queries are essential for non-relational databases to be really useful so this is an important feature.

What's the core team's opinion on this topic -- is there any chance to get something like that into Django at all? (Maybe you think two meanings for one syntax cause too much confusion)

Secondly, how could this be implemented? I thought about refactoring JOIN syntax handling into the model fields (as little logic as required; refactoring the actual hardcore JOIN generation code seems like an impossible task for anyone but the original author)... any other ideas?

So far,
Jonas

--
You received this message because you are subscribed to the Google Groups "Django 
developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to