Last active
October 28, 2015 19:48
-
-
Save devalexandre/a9dfc651d5f57c0535fc to your computer and use it in GitHub Desktop.
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
// grab the things we need | |
var mongoose = require('mongoose'); | |
var Schema = mongoose.Schema; | |
var postSchema = new Schema({ | |
title : {type:String, required:true}, | |
content : {type:String, required:true}, | |
categories:{ | |
name: {type:String, required:true}, | |
} | |
}); | |
var Post = mongoose.model('Post', postSchema); | |
// make this available to our users in our Node applications | |
module.exports = Post; |
var array = ['node','java','angular','node','jenkis'];
var arrayfilter = array.filter(function (item, i, ar) { return ar.indexOf(item) === i;})
["node", "java", "angular", "jenkis"]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ahh eu sei vai ficar duplicado, no modelo relacional eu faria um join e blz, vale salientar, que mongoDB visa performance de busca, db relacional quer economizar espaço em disco, que não faz muito sentido em um blog por exemplo.