node.js - Default values in array mongoose -


i trying make default values array in mogoose schema:

warning:  type: array  default: [10, 50, 99] 

am right in such decision or there other way this?

regarding mongoose-documentation, way correct.

here small example:

var arraytestschema = new schema({     anarray: {       type: array,       'default': [1, 2, 3]     } }); 

and link related documentation page: http://mongoosejs.com/docs/2.7.x/docs/defaults.html


Comments

Popular posts from this blog

authentication - Mongodb revoke acccess to connect test database -

ios - Realm over CoreData should I use NSFetchedResultController or a Dictionary? -

r - Update two sets of radiobuttons reactively - shiny -