我编写了这段代码,获取了一个ID,并根据该ID返回数据库的值。我认为一切正常,但出现错误:
r1.question('enter Users imdb:', await searchMoviesBaseonStarsAndDirector(imdbId));
^^^^^
SyntaxError: missing ) after argument list
这是我的代码:
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
async function searchMoviesBaseonStarsAndDirector(imdbId) {
const res = await findObjectIdByImdbId(imdbId)
console.log('%%%',res)
const a = await Movie.find( { $or:[ {'stars':res}, {'director':res} ]})
return a
}
searchMoviesBaseonStarsAndDirector.then(function(result){
console.log('***********',result)
})
r1.question('enter Users imdb:', await searchMoviesBaseonStarsAndDirector(imdbId));