2017-01-03 11 views
-1
router.route("/card").post(function(req,res) 
{ 

    var response = {}; 
    mongoOp.find({$and: [ 
        {"Mycardid" : req.body.id}, 
        {"Mycardtype" : "professional"} 
       ]}.function(err, results){ 
         console.log(results); 
       }) 
}; 

にクエリ結果を格納しながら、私はresult変数にクエリ結果を保存しようとしているメートル。それは}]}.function(err, results)の近くに私にエラーを与える。 mongoOpが私の接続オブジェクトです。エラーはSyntaxError: missing) after argument listです。なぜ私はこれを取得しているかについての任意の提案?にSyntaxError:欠落している)引数リストの後に(Node.jsの+ MongoDBの)変数

答えて

0

エラーとして、閉じ括弧が欠けていると表示されるため、匿名コールバック関数を呼び出す前にコンマを使用してデータを検索する必要があります。

router.route("/card").post(function(req,res) 
{ 

    var response = {}; 
    mongoOp.find({ $and: 
    [{"Mycardid" : req.body.id}, 
    {"Mycardtype" : "professional"}]}),function(err, results) 
    { 
    console.log(results); 
} 
)}; 
関連する問題