简体   繁体   中英

JS, Mongoose, whats the difference between Type Vs. type?

whats the difference between Type Vs. type ?!

available : {type: [ {Type:ProductAvailable} ]}

when i use type, like below:-

available : {type: [ {type:ProductAvailable} ]}

it fires errors:-

\\mongoose\\lib\\schema.js:616 throw new TypeError('Undefined type ' + name + ' at array `' + path +

TypeError: Undefined type undefined at array available

Thanks :)

type is schemaType (String,Number,Date,Buffer,Boolean,Mixed,ObjectId,Array,Decimal128,Map)

Type : is used with mongoose schema

you can also directly use below :

available : {type: [ProductAvailable]} 

meaning : available is Array of ProductAvailable

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM