Mongoose use of .select() method

前端 未结 9 1645
孤城傲影
孤城傲影 2020-12-14 14:16

I\'m pretty confused with the use of the select method. This is how I use it, and it\'s wrong:

Transaction.find({username : user.username}).sele         


        
9条回答
  •  天涯浪人
    2020-12-14 14:42

    selection & projection operation can be done in this way easyly in nodejs. Try this

        var Selection={
             : ,
             : 
            //you can add many parameters here selection operation
            };
        var Projection = {
            __v    : false,
            _id    : false
            //you can add many parameters here for projection
        };
        .find(Selection,Projection,function (err,data) {
            if(err){
                console.log(err);
            }else{
             console.log(data);
            }
        });
    

提交回复
热议问题