0 votes
in Programming by (580 points)

I am new to Node Js, I want a number of entries in my database, and I want to return it to API, I don't know how to return the data to the API. In which format we should return the data.

        getCardsModel.countDocuments({type:{$eq:"NEED"}}, function (err, count) {
            if (err){
                console.log(err)
            }else{
                console.log("Count :", count)
            }
            return [{"type": "need", "count":{count}}];
        });
        
    }

Please log in or register to answer this question.

...