Answer the question
In order to leave comments, you need to log in
How to get top records in Mongodb?
Hello, do not judge strictly, but how to get the top 50 records by the number of mentions through mongoose, for example, there is a type base
[{
name: "n1",
text: "n1"
},
{
name: "n1",
text: "n1"
},
{
name: "n2",
text: "n2"
},]
[{
name: "n1",
text: "n1"
count: 2
},
{
name: "n2",
text: "n2",
count: 1
}]
SELECT name, text, COUNT(name) AS `count`
FROM table
GROUP BY name, text
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question