Answer the question
In order to leave comments, you need to log in
How to do a text search in MongoDB?
Good day, how to search for posts on mong + their pagination?
===============This is already solved, thanks smanioso ==================
Post.paginate({ 'access' : true, $text: {$search: req.body.call} },.... и так далее
// tags это массив, остальное - типа Строка.
postSchema.index({ title: 'text', tags: 'text', text: 'text'});
// в роуте
Post.paginate({'access':true, '$text':{'$search':req.body.call}}, callback
{
"_id" : ObjectId("54beaa0a73ddc8e822708cd3"),
"addtime" : "20.1.2015",
"reviews" : 0,
"readed" : true,
"text" : "SomeTagSomeTagSomeTag",
"num" : 2,
"title" : "SomeTagSomeTag",
"access" : true,
"comments" : [],
"author" : {
"idNum" : 1
},
"tags" : [
"SomeTag"
],
"__v" : 0
}
Answer the question
In order to leave comments, you need to log in
Apparently the problem is with indexes. Read here:
- habrahabr.ru/post/174457
- stackoverflow.com/questions/24257390/mongodb-text-...
Eh ... I set the indexes like this:
// tags это массив, остальное - типа Строка.
postSchema.index({ title: 'text', tags: 'text', text: 'text'});
// в роуте
Post.paginate({'access':true, '$text':{'$search':req.body.call}}, callback
{
"_id" : ObjectId("54beaa0a73ddc8e822708cd3"),
"addtime" : "20.1.2015",
"reviews" : 0,
"readed" : true,
"text" : "SomeTagSomeTagSomeTag",
"num" : 2,
"title" : "SomeTagSomeTag",
"access" : true,
"comments" : [],
"author" : {
"idNum" : 1
},
"tags" : [
"SomeTag"
],
"__v" : 0
}
A memory leak is easily checked.
When 502 starts, just see how many processes are eating up memory.
Let's say the operating system's top command.
If go is eating up ALL available memory on the server, then yes, that's it.
If go eats a lot but still a lot of free memory in the operating system, then this is not it, not the memory leak that you suspect.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question