@olaf
> It looks like you want to aggregate your data by "createdAt" at the first > level. no i just want to aggregate my my data by product name only "outletId" seems to be not part of your document at your gist. i updated gist my document is very large i only write relevant part not whole object any way now i have updated it now please tell me how to pull top selling products and by date and store id On Tue, Dec 14, 2021 at 6:31 PM Rizwan Chouhan <chouhan.riz...@gmail.com> wrote: > @olaf > > >> It looks like you want to aggregate your data by "createdAt" at the first >> level. > > > no i just want to aggregate my my data by product name only > > "outletId" seems to be not part of your document at your gist. > > > On Tue, Dec 14, 2021 at 6:10 PM Olaf Krüger <okrue...@apache.org> wrote: > >> Hi, >> >> > please help me and guide me what i am doing wrong >> >> I just took a quick look into your gist: >> It looks like you want to aggregate your data by "createdAt" at the first >> level. >> If so, it might makes sense to start with the date within your key: >> emit(["createdAt", "outletId", "name"], ...) >> >> BTW 1: >> You might want to use "createdAt.substring(0,10)" in order to extraxt the >> date instead of invoking "Date()" a couple of times. >> >> BTW 2: >> "outletId" seems to be not part of your document at your gist. >> >> Maybe this helps, >> Olaf >> >