This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mongoose = require('mongoose'); | |
var validate = require('mongoose-validator'); | |
var Schema = mongoose.Schema; | |
var crypto = require('crypto'); | |
var utilities = require('../services/utilities'); | |
var userSchema = new Schema({ | |
firstname: { type : String, trim : true }, | |
lastname: { type : String, trim : true }, | |
username: { type: String, required: true, unique: true, lowercase: true, trim : true, index : true }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// expressJS route | |
router.get('/search', function(req, res, next) { | |
Product.find({ $text: { $search: req.param('title') } } , function(err, docs){ | |
res.render('shop/search', {products: docs} ); | |
}); | |
}); |