Extracting Month from date during a query

13 views
Skip to first unread message

Eswar Subramanyam

unread,
Mar 22, 2020, 1:17:01 PM3/22/20
to Django users
I am using MongoDB as underlying DB with Django.

pipeline =  {
'price' : Sum('price'),
'month' : ExtractMonth('dateValue'),
}

queryset = ListingBooks.objects.values('dateValue','typeBook').annotate(**pipeline)

Unfortuantely i get a NotImplementError, as if Djongo ORM i use doesnt implement this function.

Can anyone hint me on how to keep the grouping by month at this query level without having to do it manually at the serverside or client side ?

Thank you
Es. 
Reply all
Reply to author
Forward
0 new messages