Search text on MongoDB (single, two fields)

var skip = 0;
var limit = 5;
var search = "apple";

// search text in one field (title)
News.find({ title: { $regex: search } }).sort({ pubDate: -1 })
.skip(skip).limit(limit).exec(function (err, data) {

// search text in two fields (title and description)
News.find({ $or: [{ title: { $regex: search } }, { description: { $regex: search } }] })
.sort({ pubDate: -1 }).skip(skip).limit(limit).exec(function (err, data) {


  1. Home | Casino | Jordan12-Retro
    The ultimate in online gambling, Jordan12 was built to meet air jordan 18 retro yellow cheap the needs 야구 실시간 of the most discriminating and air jordan 18 retro racer blue from us experienced sports bettors. It is air jordan 18 retro red online free shipping a place to gamble in air jordan 18 retro men blue sports and out


댓글 쓰기

이 블로그의 인기 게시물

mongoDB admin 권한 설정방법 How to enable access control for mongo DB

Install node and yarn on Linux

Install pm2 via yarn globally