我一直在尝试在我的数据库模式中输出集合数组。假设我的会话有效,我会得到一个我认为正常的 Promise{} 输出。
.then(()=>{
return sess.getSchema('mySchema').getCollection('myCollection')
.find().fields(['name','age'])
.execute(row=>{
console.log(row)
})
})
.then(()=>{
let r = sess.getSchema('mySchema').getCollections()
console.log(r)
return r
})
但如果我试图获得承诺中的价值
let r = sess.getSchema('mySchema').getCollections()
r.then(v=>{
console.log(v)
})
它返回我这些会话回调函数
[
{
getSession: [Function: getSession],
add: [Function: add],
addOrReplaceOne: [Function: addOrReplaceOne],
count: [Function: count],
existsInDatabase: [Function: existsInDatabase],
find: [Function: find],
getName: [Function: getName],
getSchema: [Function: getSchema],
inspect: [Function: inspect],
modify: [Function: modify],
remove: [Function: remove],
removeOne: [Function: removeOne],
replaceOne: [Function: replaceOne],
dropIndex: [Function: dropIndex],
createIndex: [Function: createIndex],
getOne: [Function: getOne]
}
]