I'm not sure what you plan to store / do with tokens, so if this does not answer your question, check out :)
I assume that you either mean:
Both are possible by directly modifying the mongoose schema , rather than using the Keystone add method on List .
To add the path to the array (so that you can, for example, store an array of tokens of strings generated by some process when saving), you will do the following:
var keystone = require('keystone'), Types = keystone.Field.Types; var Info = new keystone.List('Info'); Info.add({ title: { type: String, required: true, initial: true }, subtitle: { type: String, initial: true }, content: { type: Types.Markdown, height: 500, initial: true }, author: { type: Types.Relationship, ref: 'User', initial: true }, date: { type: Types.Date, default: Date.now, initial: true }, published: { type: Boolean, default: false, initial: true } }); Info.schema.add({ tokens: { type: [String] } }); Info.defaultColumns = 'title, author, date|15%, published|15%'; Info.register();
To create a virtual property, you must specify it using the receiver as follows:
Info.schema.virtual('tokens', function() { var tokens = [];
By accessing the schema, you bypass the Keystone list, which means that the fields will not be displayed in the admin user interface. There is a problem to add support for user patterns in the admin user interface, although this will allow this in the future.
There is also a problem for the field type of the array type , so if you now save the rows in the array, you can include it in the admin user interface when this function is implemented.
In the corresponding note, all mongoose functional offers are accessible through the scheme, so that you can define things like user methods, statics, and preliminary / post save hooks. For more information on what you can do with mongoose schemes, see the guide .