How to display data from mongodb in frontend using express js without knowing feilds name?
答案 0 :(得分:0)
If you want to display the raw data, you can simply assign the returned data to a string and display that.
Otherwise, you can delimit the data with a colon ( : ), and map the delimited data to objects or variables as you see fit.
You can then return the mapped data via your API.
答案 1 :(得分:0)
在快递处理程序中,使用如下代码:
res.render('index', { dump: JSON.stringify(your_db_object)});
然后在您的视图中显示带有pre标签的转储数据:
<pre>{{dump}}</pre>