Skip to content
Snippets Groups Projects
Commit f5d1cc58 authored by Inès Yeterian's avatar Inès Yeterian
Browse files

try to add new model

parent ce7adb9a
No related branches found
No related tags found
No related merge requests found
......@@ -10,4 +10,22 @@ var toucanSchema = new Schema ({
date: {type : Date, required: true},
});
module.exports = mongoose.model("Toucan",toucanSchema);
\ No newline at end of file
// La date doit être unique
toucanSchema.index({date:-1},{unique: true});
const toucanModele = mongoose.model("Toucan",toucanSchema);
var toucanDSchema = new Schema ({
title: {type : String, required: true}, // Chaque toucan doit avoir un titre et une date
date: {type : Date, required: true},
issue: {type: Number, required: true},
urlId: {type: String, required: true}
});
// Le numéro doit être unique
toucanDSchema.index({issue:-1},{unique: true});
const toucanDModele = mongoose.model("ToucanD",toucanDSchema);
module.exports = {toucanModele, toucanDModele};
\ No newline at end of file
var mongoose = require("mongoose");
var Schema = mongoose.Schema;
/**
* Indique ce que l'on doit trouver dans un toucan
*/
var toucanDSchema = new Schema ({
title: {type : String, required: true}, // Chaque toucan doit avoir un titre et une date
date: {type : Date, required: true},
issue: {type: Number, required: true},
urlId: {type: String, required: true}
});
// Le numéro doit être unique
toucanDSchema.index({issue:-1},{unique: true});
module.exports = mongoose.model("ToucanD",toucanDSchema);
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment