How to show mongodb data on another iterator?


I’m fairly new to meteor, so here come some stupid questions in the beginning.

I have set up JS file Month.jsx in ui, which contains:

export const Month = ({ month }) => {
const days = getDaysArray(2023, 01)


{ => <Day key={ } day={ day }/>) }


I want to do the mongodb query of this month days, and for some days I get the result, for other days no. I would like to set the unique index to be Date - is this possible? Then, I want to pass the date object of every day, as I get it from DB, to this Day where I have day={day}, but I interate over this array, not over the DB result set - so I have to do the second query to the result set, to get specific day. Can I somehow organize the mongodb result so that I get something like this:

import { DaysCollection } from ‘/imports/api/DaysCollection’;

export const Month = ({ month }) => {
// Here how to select the days from DaysCollection for this month into an object so that the following is possible…
DaysCollection.find({“day”: {“gte”: new Date(2023, 01-1, 1), “lt”: new Date(2023, 01, 1)}}).fetch()
const days = getDaysArray(2023, 01)


{ => <Day key={ /* here, is the date type of key possible? / } day={ / here, the item which gets this specific day from the dayscollection object, but only if it exists */ }/>) }


Is this the right mongodb query dor day in january of 2023? It should be greater or equal to 1’st jan. of 2023 and smaller than 1’st feb.? Now I don’t know the accessor to this array such that for any given day, I get the item for this day - I can iterate over the days array, but I do not want to iterate, I want to get the value for a given day as I iterate over another object, all the days in a month.

Hi @tambetvali,

welcome to Meteor and to this forum.
I think it would be hard to get any constructive reply on this as most people expect code samples to be formatted. I tried to follow but it is really hard.

Unless someone replies to you soon, please consider to spare 15 minutes or so and we can do a 1:1 over Skype (if that still exists) Zoom or something else. My local time is GMT+4.
There are various tools and ways to look at your data that I can show you on my computer.

Can I send you my Skype address privately? Alternately I delete it from here as soon as you read it :slight_smile: And, I dont have camera attached to this computer, we have to chat.

In code examples getDaysArray(2023, 01) is simply a function returning all days at january 2023 (my calendar initially supports only that month :P) and in this later “find” query I am trying to find objects between two given dates, again in january 2023. Later I try to set up date object as unique key for my db - this is completely untested code, but to the point, I would like to know is this possible.

Sure. I am actually available