在查询中获取mongodb错误。这里的错误:
TypeError:无法读取null的属性“ length”
代码如下:
// Open a connection with MongoDB
MongoClient.connect(process.env.MONGO_URL, (error, db) => {
let dbo = db.db('gamblenomore');
//Running a query to find all customers that are in timezone CST.
dbo.collection('customers').find({therapyConfirmation: true, therapyTimeZone: 'CST', therapyDay: { $gt: 0 } }).toArray((error, result) => {
let max = result.length;
if (error) {
throw error;
}
'customers'
中目前没有符合上述条件的文档。
答案 0 :(得分:0)
将代码更改为:
login.component.ts