{"size": 535, "ext": "js", "max_stars_repo_path": "src/api-node/src/models/Product.js", "max_stars_repo_name": "jonathanccardoso/work-exercises", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/api-node/src/models/Product.js", "max_issues_repo_name": "jonathanccardoso/work-exercises", "max_issues_repo_issues_event_min_datetime": "2021-03-19T03:29:41.000Z", "max_issues_repo_issues_event_max_datetime": "2021-09-22T19:02:58.000Z", "max_forks_repo_path": "src/api-node/src/models/Product.js", "max_forks_repo_name": "jonathanccardoso/work-exercises", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 5, "max_forks_count": null, "avg_line_length": 17.2580645161, "max_line_length": 54, "alphanum_fraction": 0.6934579439}
//Schema - adcionanr campo e seus valores

const mongoose = require('mongoose');
const mongoosePaginate = require('mongoose-paginate');

//objeto
const ProductSchema = new mongoose.Schema({
	title: {
		type: String,
		required: true,
	},
	description: {
		type: String,
		required: true,
	},
	url: {
		type: String,
		required: true,
	},
	//data de criacao de cada produto
	createdAt: {
		type: Date,
		dafault: Date.now,
	},
});

ProductSchema.plugin(mongoosePaginate);

//registrar um model
mongoose.model('Product', ProductSchema);
