Meteor 如何在简单模式中添加坐标作为自动值?

Meteor 如何在简单模式中添加坐标作为自动值?,meteor,Meteor,以下是坐标的简单模式: { loc: { type: Object, index: '2dsphere', label: "Location", autoform: { type: "hidden", omit: true } }, "loc.type": { type:

以下是坐标的简单模式:

{
  loc: {
        type: Object,
        index: '2dsphere',
        label: "Location",
        autoform: {
                    type: "hidden",
                    omit: true
                    }
        },

  "loc.type": {
        type: String,
        allowedValues: ["Point"],
        label: "Start location type"
        },

  "loc.coordinates": {
        type: [Number],
        minCount: 2,
        maxCount: 2,
        decimal: true,
        autoValue: function () {
                    var lat = document.getElementById("latitude");
                    var lng = document.getElementById("longitude");
                    var location1 = [lat, lng];
                    return location1;
                    }
            }
}
作为方法,我在服务器端使用了以下方法:

Meteor.methods({
    createLocation: function(userID,lat, lng) {
        ComplaintSchema.upsert({_id: userID}, {coordinates: [lat, lng]});
    }
});
对于客户端,我使用了以下方法:

'submit': function () {
        var id = Meteor.userId();
        var lat=document.getElementById("latitude").value;
        var lng=document.getElementById("longitude").value;
        Meteor.call('createLocation',id,lat,lng, function(err){
           if(err) console.log("not going in");
        });
        Router.go('/Home');
    }
它抛出了一个错误“不进去”。 如何在loc.coordinates中插入值,这种情况下的语法是什么?是这样的吗?

ComplaintSchema.upsert({_id: userID}, {"loc.coordinates": [lat, lng]});
它还必须将loc.type的值添加为point,我将如何做

请帮助我

先谢谢你