Я пытаюсь создать сайт nodejs для отображения содержимого данных, которые я собрал и сохранил в коллекции mongodb. Я могу выполнить очистку и получить данные в БД, но не могу их вернуть. Я предполагаю, что проблема не в правильном определении схемы в моей модели узла.
Данные - это массивы строк.
{
"_id": {
"$oid": "5ca553dc97c32c1f05aba38d"
},
"title": [
"Official Foreign Reserves(March 2019)"
],
"date": [
"2019.04.03"
],
"summary": [
"The Consumer Price Index was 104.49(2015=100) in March 2019. The index decreased 0.2 percent from the preceding",
"month and rose 0.4 percent from the same month of the previous year.",
"The index excluding food and energy was 105.32 in March 2019. The index decreased 0.1 percent from the preceding",
"month and rose 0.8 percent from the same month of the previous year.",
"For more information, refer to the attached file.",
""
]
}
Я пытался определить схему следующим образом:
const ScrapeSchema = new Schema({
title:{
type: Array, "default" : []
},
date:{
type: Array, "default" : []
},
summary:{
type: Array, "default" : []
}
});
Объект, который я возвращаю, пуст. Mongodb подключается нормально и ошибок нет.
В настоящее время я просто использую find ({}) в запросе.