Page 531 - Nodejs 교과서 개정2판
P. 531

},
           });


           module.exports	=	mongoose.model('Room',	roomSchema);




         ߑ ઁݾ title   ୭؀ ࣻਊ ੋਗ max   ߑ੢ owner   ࠺޻ߣഐ password   ࢤࢿ दр DSFBUFE"U  ١ਸ ߉णפ׮
         ࣻਊ ੋਗ਷ ӝࠄ੸ਵ۽   ݺ  ୭ࣗ ੋਗ਷  ݺ ੉࢚ਵ۽ ࢸ੿೤פ׮  ଻౴ߑী ഒ੗ ੓ਵݶ ইޖ ੄޷о হਵפ

         өਃ  ࠺޻ߣഐח required ࣘࢿ੉ হਵ޲۽ ԙ ֍૑ ঋইب ؾפ׮  ࠺޻ߣഐܳ ࢸ੿ೞݶ ࠺޻ߑ  ࢸ੿ೞ૑ ঋ
         ਵݶ ҕѐߑੑפ׮


         ੉ߣীח ଻౴ झః݃ܳ ٟ݅פ׮

          schemas/chat.js

           const	mongoose	=	require('mongoose');


           const	{	Schema	}	=	mongoose;
           const	{	Types:	{	ObjectId	}	}	=	Schema;
           const	chatSchema	=	new	Schema({
           		room:	{
           				type:	ObjectId,
           				required:	true,
           				ref:	'Room',
           		},
           		user:	{
           				type:	String,
           				required:	true,
           		},
           		chat:	String,
           		gif:	String,
           		createdAt:	{
           				type:	Date,
           				default:	Date.now,
           		},
           });


           module.exports	=	mongoose.model('Chat',	chatSchema);




         ଻౴ߑ ই੉٣ room ৬ ଻౴ਸ ೠ ࢎۈ user   ଻౴ ղ৉ chat   (*' ੉޷૑ ઱ࣗ img   ଻౴ दр createdAt ਸ
         ੷੢೤פ׮  room ೙٘ח Room झః݃৬ োѾೞৈ 3PPN ஸ۩࣌੄ ObjectIdо ٜযоѱ ؾפ׮  chat ژח img

         ೙٘ী required ࣘࢿ੉ হח ੉ਬח ଻౴ ݫद૑ա (*' ੉޷૑ ઺ীࢲ ೞա݅ ੷੢ೞݶ غӝ ٸޙੑפ׮

         ׮਺਷ ކҊ٣࠺৬ োѾೞח ௏٘ੑפ׮
   526   527   528   529   530   531   532   533   534   535   536