Simple Schema从集合中填充默认值

时间:2017-07-27 23:32:15

标签: simple-schema

如何通过调用Meteor js中的集合来填充简单模式的默认值,而不是定义"测试"在defaultValue中如下?如果可能,则使用TestList = new Mongo.Collection(' testList')返回allValue。

StudentSchema = new SimpleSchema({

tests: {
type: [Object],
blackbox: true,
optional: true,

defaultValue:[
    {
        "_id" : "T2yfqWJ3a5rQz64WN",
        "category_id" : "5",
        "active" : "true",
        "category" : "Cognitive/Intelligence",
        "abbr" : "WJ-IV COG",
        "name" : "Woodcock-Johnson IV, Tests of Cognitive Abilities",
        "publisher" : "Riverside Publishing"
    },


    {
        "_id" : "Ai8bT6dLYGQRDfvKe",
        "category_id" : "5",
        "active" : "true",
        "category" : "Cognitive/Intelligence",
        "abbr" : "WISC-IV",
        "name" : "Wechsler Intelligence Scale for Children-Fourth Edition",
        "publisher" : "The Psychological Corporation"
    },

    {
        "_id" : "osAuaLrX97meRZuda",
        "category_id" : "7",
        "active" : "true",
        "category" : "Speech and Language",
        "abbr" : "WOJO",
        "name" : "Wechsler Intelligence",
        "publisher" : "The Psychological Corporation"
    },

    {
        "_id" : "57c62a784b94c533b656dba8",
        "category_id" : "5",
        "active" : "true",
        "category" : "Behavioral",
        "abbr" : "CARS",
        "name" : "CARS",
        "publisher" : "The Psychological Corporation"
    }
],

);   },

1 个答案:

答案 0 :(得分:0)

将“TestList”集合中的所有条目动态加载到“tests”数组中。

add_filter('gettext', 'translate_text',999);
add_filter('ngettext', 'translate_text',999);