diff --git a/docs/ref/contrib/postgres/fields.txt b/docs/ref/contrib/postgres/fields.txt index dcde84d2ec..85ba6096b5 100644 --- a/docs/ref/contrib/postgres/fields.txt +++ b/docs/ref/contrib/postgres/fields.txt @@ -157,6 +157,20 @@ the SQL operator ``&&``. For example:: >>> Post.objects.filter(tags__overlap=['thoughts', 'tutorial']) [, , ] +.. fieldlookup:: arrayfield.len + +len +~~~ + +Returns the length of the array. The lookups available afterwards are those +available for :class:`~django.db.models.IntegerField`. For example:: + + >>> Post.objects.create(name='First post', tags=['thoughts', 'django']) + >>> Post.objects.create(name='Second post', tags=['thoughts']) + + >>> Post.objects.filter(tags__len=1) + [] + .. fieldlookup:: arrayfield.index Index transforms