Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이승윤
/
OpenSource-MyCookBook
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
이승윤
2021-05-29 23:34:16 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a4dc8019eedea5cbd5b741fb563e2a138a1a7d86
a4dc8019
1 parent
11007bdb
fix: ProductsModel 삭제
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
35 deletions
models/ProductsModel.js
models/ProductsModel.js
deleted
100644 → 0
View file @
11007bd
var
mongoose
=
require
(
'mongoose'
);
var
Schema
=
mongoose
.
Schema
;
//생성될 필드명을 정한다.
var
ProductsSchema
=
new
Schema
({
name
:
{
//제품명
type
:
String
,
required
:
[
true
,
'제목은 입력해주세요'
],
},
thumbnail
:
String
,
//이미지 파일명
price
:
Number
,
//가격
description
:
String
,
//설명
created_at
:
{
//작성일
type
:
Date
,
default
:
Date
.
now
(),
},
username
:
String
,
//작성자추가
});
ProductsSchema
.
virtual
(
'getDate'
).
get
(
function
()
{
var
date
=
new
Date
(
this
.
created_at
);
return
{
year
:
date
.
getFullYear
(),
month
:
date
.
getMonth
()
+
1
,
day
:
date
.
getDate
(),
};
});
// 1씩 증가하는 primary Key를 만든다
// model : 생성할 document 이름
// field : primary key , startAt : 1부터 시작
module
.
exports
=
mongoose
.
model
(
'products'
,
ProductsSchema
);
\ No newline at end of file
Please
register
or
login
to post a comment