在我的情况下,我只想在文件夹中创建一个连接。
这是我的代码:
const urls = ['/room/*/userconfig', '/room/*/observation/latest'];
let requests = urls.map(url => axios.get(url));
Promise.all(requests)
.then(res => {
let patientDetailsArray = Object.values(res[0].data);
let patientObservationsArray = Object.values(res[1].data);
const mergedArray = patientDetailsArray.map(obj => {
const matched = patientObservationsArray.find(obs => obs.observation.patient === obj.patient);
axios.get(`/patient/${obj.patient}/name`)
.then(res => {
let patientName = res.data;
let patientObj = {
...obj,
name: patientName,
id: obj.patient,
};
if (matched) {;
patientObj = { ...patientObj, timestamp: matched.observation.timestamp };
}
return patientObj;
})
.then(() => this.setState({ patients: [...this.state.patients, ...mergedArray] }));
})
});
如果仅使用“ mongodb:// localhost:27017 / file”,则可以创建连接,但实际上我必须管理音频文件中的所有数据。
启动控制台时,错误是:
export const connectionAvatar = mongoose.createConnection(
'mongodb://localhost:27017/file/audio', // I think mongo don't let me to create the folder audio
options
)