繁体   English   中英

流星服务器在SimpleSchema autoValue选项上崩溃

[英]Meteor server is crashing on SimpleSchema autoValue option

我是使用MeteorJS开发应用程序的新手,在快速库存应用程序中收集某些物品时会出现问题。

这是错误:

/home/operador/.meteor/packages/meteor-tool/.1.1.10.1kpywhr++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:245
                    throw(ex);
                          ^
Error: Invalid definition for active field.
at packages/aldeed_simple-schema/packages/aldeed_simple-schema.js:1328:1
at Function._.each._.forEach (packages/underscore/underscore.js:113:1)
at [object Object].SimpleSchema (packages/aldeed_simple-schema/packages/aldeed_simple-schema.js:1325:1)
at collections/assets.js:16:16
at /home/operador/fijos/.meteor/local/build/programs/server/app/collections/assets.js:64:4
at /home/operador/fijos/.meteor/local/build/programs/server/boot.js:242:10
at Array.forEach (native)
at Function._.each._.forEach (/home/operador/.meteor/packages/meteor-tool/.1.1.10.1kpywhr++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/server-lib/node_modules/underscore/underscore.js:79:11)
at /home/operador/fijos/.meteor/local/build/programs/server/boot.js:137:5
Exited with code: 8
Your application is crashing. Waiting for file change.

这是assets.js

Assets = new Mongo.Collection('assets')

Assets.allow({
    insert: function(userId, userLvl, doc) {
        return !!userId;
    }
});

Brands = new SimpleSchema({
    name: {
        type: String,
        label: "Brand"
    }
});

Assetsschema = new SimpleSchema({
    item: {
        type: String,
        label: "item"
    },
    year: {
        type: Date,
        label: "year"
    },
    model: {
        type: String,
        label: "model"
    },
    serialNumber: {
        type: String,
        label: "serialNumber"
    },
    brand: {
        type: [Brands]
    },
    adquarance: {
        type: Date,
        label: "adquaranceDate"
    },
    codebar: {
        type: String,
        label: "codebar"
    },
    qrcode: {
        type: String,
        label: "QRcode"
    },
    active: {
        type: Boolean,
        label: "active",
        autoValue: true
    }
});

IDK如何解决该问题,我试图更改架构的名称,但这给了我相同的结果。

这是我的包裹清单:

kadira:flow-router
kadira:blaze-layout
erasaur:meteor-lodash
fortawesome:fontawesome
spiderable
fastclick
raix:handlebar-helpers
aldeed:collection2
aldeed:autoform
accounts-ui
accounts-password
matb33:bootstrap-glyphicons
zimme:active-route
gwendall:auth-client-callbacks
meteortoys:allthings
datariot:ganalytics
bootswatch:paper
numtel:mysql
hitchcott:qr-scanner

选项autoValue允许您指定一个函数。 因此,您的架构应按以下结构进行构造:

Assetsschema = new SimpleSchema({
    item: {
        type: String,
        label: "item"
    },
    year: {
        type: Date,
        label: "year"
    },
    model: {
        type: String,
        label: "model"
    },
    serialNumber: {
        type: String,
        label: "serialNumber"
    },
    brand: {
        type: [Brands]
    },
    adquarance: {
        type: Date,
        label: "adquaranceDate"
    },
    codebar: {
        type: String,
        label: "codebar"
    },
    qrcode: {
        type: String,
        label: "QRcode"
    },
    active: {
        type: Boolean,
        label: "active",
        autoValue: function () {
            return true;
        }
    }
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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