How can I create the array of strings in Keystone.js Database ODM? I have to create new model with single field and make a many:true
relationship with him only?
How can I create the array of strings in Keystone.js Database ODM?
possible duplicate of How to add virtual property of type Array using Keystone.js? –
Rosenkranz
Some documentation about the solution of this (Types.TextArray) is avalable on Github github.com/keystonejs/keystone/tree/master/fields/types/… –
Sandblast
There is a field type for this:
Things.add({
manyStrings: { type: Types.TextArray }
});
There is a similar field for numbers called Types.NumberArray
.
If you want something more sophisticated, your best bet is creating a separate List and using the Relationship
field.
Can we use array of other types? like Types.NumberArray –
Impetrate
How come the documentation doesn't mention Types.TextArray? –
Kunz
@JedWatson the lack of documentation is killer! –
Bim
+1 @Kunz Docs could be much better. Check
project/node_modules/keystone/fields/types
to see all types. –
Shirr @Kunz At the time of your comment, the TextArrays are not in the current old-but-stable v0.3.x documentation, while the Array types are of the v4.0.0-beta.4 or beta 5. There is already some documentation about this on Github only github.com/keystonejs/keystone/tree/master/fields/types/… –
Sandblast
© 2022 - 2024 — McMap. All rights reserved.