File tree Expand file tree Collapse file tree 2 files changed +31
-36
lines changed
Expand file tree Collapse file tree 2 files changed +31
-36
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ const updateChildernPathRecursive = async (item) => {
77
88 for ( const child of children ) {
99 child . path = `${ item . path } /${ child . name } ` ;
10- await child . save ( ) ;
10+ await child . save ( { timestamps : false } ) ;
1111
1212 if ( child . isDirectory ) updateChildernPathRecursive ( child ) ;
1313 }
Original file line number Diff line number Diff line change 11const mongoose = require ( "mongoose" ) ;
22
3- const fileSystemSchema = new mongoose . Schema ( {
4- name : {
5- type : String ,
6- required : true ,
7- } ,
8- isDirectory : {
9- type : Boolean ,
10- required : true ,
11- } ,
12- path : {
13- type : String ,
14- required : true ,
15- } ,
16- parentId : {
17- type : mongoose . Schema . Types . ObjectId ,
18- ref : "FileSystem" ,
19- default : null ,
20- } ,
21- size : {
22- type : Number ,
23- default : null , // For files only
24- } ,
25- mimeType : {
26- type : String ,
27- default : null , // For files only
28- } ,
29- createdAt : {
30- type : Date ,
31- default : Date . now ( ) ,
32- } ,
33- updatedAt : {
34- type : Date ,
35- default : Date . now ( ) ,
36- } ,
37- } ) ;
3+ const fileSystemSchema = new mongoose . Schema (
4+ {
5+ name : {
6+ type : String ,
7+ required : true ,
8+ } ,
9+ isDirectory : {
10+ type : Boolean ,
11+ required : true ,
12+ } ,
13+ path : {
14+ type : String ,
15+ required : true ,
16+ } ,
17+ parentId : {
18+ type : mongoose . Schema . Types . ObjectId ,
19+ ref : "FileSystem" ,
20+ default : null ,
21+ } ,
22+ size : {
23+ type : Number ,
24+ default : null , // For files only
25+ } ,
26+ mimeType : {
27+ type : String ,
28+ default : null , // For files only
29+ } ,
30+ } ,
31+ { timestamps : true }
32+ ) ;
3833
3934const FileSystem = mongoose . model ( "FileSystem" , fileSystemSchema ) ;
4035
You can’t perform that action at this time.
0 commit comments