Skip to content

Instantly share code, notes, and snippets.

Created October 8, 2017 16:02
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
// Define a schema.
var userSchema = new Schema({
name: String,
blog: String,
age: Number,
location: String
// Define a method for concatanation of name and blog fields.
userSchema.methods.concatanceNameAndBlog = function() {
// Extend name with value of the blog field. = +;
// Create a model.
var User = mongoose.model('User', userSchema);
module.exports = User;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment