File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,6 +10,10 @@ class AdminLogEntity {
1010 public username ?: string ;
1111}
1212
13+ interface AdminLogSaveParams {
14+ username ?: string ,
15+ }
16+
1317async function main ( ) {
1418 await mongoose . connect ( `mongodb://localhost:27017/` , {
1519 dbName : 'verifyMASTER' ,
@@ -19,11 +23,24 @@ async function main() {
1923 const adminLogModel : ReturnModelType < typeof AdminLogEntity , BeAnObject > = getModelForClass ( AdminLogEntity ) ;
2024 const options : mongoose . CreateOptions = { session } ;
2125
22- const adminLogEntity = await adminLogModel . create ( { } , options ) ;
26+ const params = {
27+ username : 'a' ,
28+ }
29+
30+ const params2 : AdminLogSaveParams = {
31+ username : 'b' ,
32+ }
33+
34+ const adminLogEntity = await adminLogModel . create ( params , options ) ;
35+ const adminLogEntity2 = await adminLogModel . create ( params2 , options ) ;
36+ const adminLogEntity3 = await adminLogModel . create ( { username : 'a' } , options ) ;
2337
2438 console . log ( 'entity' , adminLogEntity ) ;
39+ console . log ( 'entity2' , adminLogEntity2 ) ;
40+ console . log ( 'entity3' , adminLogEntity3 ) ;
2541
2642 await mongoose . disconnect ( ) ;
2743}
2844
2945main ( ) ;
46+
Original file line number Diff line number Diff line change 11{
2- "compileOnSave" : true ,
3- "typeAcquisition" : {
4- "enable" : true
5- },
6- "compilerOptions" : {
7- "experimentalDecorators" : true ,
8- "emitDecoratorMetadata" : true ,
9- "declarationMap" : true ,
10- "outDir" : " lib" ,
11- "moduleResolution" : " node" ,
12- "target" : " ES2021" ,
13- "module" : " commonjs" ,
14- "newLine" : " LF" ,
15- "sourceMap" : true ,
16- "removeComments" : true ,
17- "strict" : true ,
18- "allowUnreachableCode" : false ,
19- "pretty" : true ,
20- "declaration" : true ,
21- "incremental" : true ,
22- "tsBuildInfoFile" : " .tsbuildinfo" ,
23- "lib" : [
24- " esnext"
25- ]
26- },
27- "include" : [
28- " src/**/*"
29- ]
2+ "compileOnSave" : true ,
3+ "typeAcquisition" : {
4+ "enable" : true
5+ },
6+ "compilerOptions" : {
7+ "experimentalDecorators" : true ,
8+ "emitDecoratorMetadata" : true ,
9+ "declarationMap" : true ,
10+ "outDir" : " lib" ,
11+ "moduleResolution" : " node" ,
12+ "target" : " ES2021" ,
13+ "module" : " commonjs" ,
14+ "newLine" : " LF" ,
15+ "sourceMap" : true ,
16+ "removeComments" : true ,
17+ "strict" : true ,
18+ "strictPropertyInitialization" : false ,
19+ "allowUnreachableCode" : false ,
20+ "pretty" : true ,
21+ "declaration" : true ,
22+ "incremental" : true ,
23+ "tsBuildInfoFile" : " .tsbuildinfo" ,
24+ "lib" : [" esnext" ]
25+ },
26+ "include" : [" src/**/*" ]
3027}
You can’t perform that action at this time.
0 commit comments