Skip to content

Instantly share code, notes, and snippets.

Created July 6, 2017 16:21
  • 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?
sample schema for mongoose
const mongoose = require('mongoose');
mongoose.Promise = require('bluebird');
const gameSchema = new mongoose.Schema({
name: {type: String, required: true},
imageUrl: {type: String, required: true},
tags: [String],
year: {type: Number, required: true},
link: {type: String, required: true}
const Game = mongoose.model('Game', gameSchema);
const game = new Game() = "Contra"
game.imageUrl = "The imageUrl"
game.year = 1985 = "The link"
.then( function(game){
console.log("Check mongo!")
.catch( function(validationError){
console.log("Sorry sucker!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment