mirror of
				https://github.com/KevinMidboe/planetposen.git
				synced 2025-10-29 17:50:32 +00:00 
			
		
		
		
	Server handles creating and fetching products and their variations. Models are saved to mongo using mongoose. STILL PRETTY BARE BONES!
		
			
				
	
	
		
			16 lines
		
	
	
		
			309 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			309 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| const mongoose = require('mongoose');
 | |
| const Schema = mongoose.Schema;
 | |
| 
 | |
| const Product = new Schema({
 | |
|   name: String,
 | |
|   image: String,
 | |
|   description: String,
 | |
|   urlSlug: String,
 | |
|   variations: [{
 | |
|     type: Schema.Types.ObjectId,
 | |
|     ref: "Variation"
 | |
|   }]
 | |
|  });
 | |
| 
 | |
| module.exports = mongoose.model("Product", Product)
 |