my website takes a dataset and the dataset contains data about a students or employees..etc, so I want to display the column names to the user.
Is there a way to pull the fields name?
ex:
Name, Age, Country
String, Number, String
Fahad, 13, riyadh
Jane, 27, United Kingdom
Andrew, 29 , United States
Mary, 19 , France
I want to display "Name" "Age" "Country" to the user
I’m using node.js mongoose.
2
Answers
If your documents have similar structure, why not just
for more accurate u need use the lean() method because it will
POJO values else it will return mongodb instance keys instead of document keys.