Skip to content

Instantly share code, notes, and snippets.

View 01speed1's full-sized avatar
🥑
Full Stack Developer

Oscar Guzman 01speed1

🥑
Full Stack Developer
View GitHub Profile
@01speed1
01speed1 / models-user.js
Created January 31, 2017 23:23 — forked from jdnichollsc/models-user.js
Search users with fullname in MongoDB using Mongoosejs and Aggregation Framework in Node.js
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 },
@01speed1
01speed1 / index.js
Created January 31, 2017 23:23 — forked from diegoachury/index.js
Buscador fulltext mongodb + express
// 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} );
});
});