Hi everyone, I have nextjs project where I use MongoDB to get data, so when I fetch data I want to get types, I show you what result I want to get.
please consider that, I want such an array because I want to know what type of data is coming, when I get “_id”, “typeof” gives me “String” (I know why it doing such), and I want to get that _id is a “ObjectId”, and so on
But using $type(please click on the link and look at the examples) is a server thing. It has nothing to do with nextjs or what ever client you are using.
I just found out the following which might be a better solution