我正在尝试获取返回.cert主体的请求,但是使用bluebird的.spread似乎只返回1个参数,而不是它应该返回两个参数.
request.getAsync( {url: payload.publicKeyUrl, encode:null } )
.spread( function(res, body){
console.log(body);
} );
Run Code Online (Sandbox Code Playgroud)
这将抛出一个未定义主体的错误.响应返回ENTIRE json格式,包括与结构混淆的字符串格式的证书.
我正在使用请求2.67.0和bluebird 3.1.1.这是证书网址:https://static.gc.apple.com/public-key/gc-prod-2.cer
我收到以下错误:
MongoError: Can't extract geo keys: { _id: ObjectId('5aba6a88d366dbbf6c83a5d3'), gpshits: [ { coordinates: [ 6.982654547382455, 46.88414220428685 ], _id: ObjectId('5aba6a8fd366dbbf6c83a5d4'), type: "Point" } ], licenseplate: "xxaa22", createdAt: new Date(1522166408205), updatedAt: new Date(1522166415372), __v: 0 } Point must only contain numeric elements
Run Code Online (Sandbox Code Playgroud)
是因为我错误地将 Point 嵌套在模型中吗?我已阅读文档,但找不到如何正确定位数组的示例。它没有给出任何错误。主要是尝试在车牌号上保留 GPS 命中记录。
模型:
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var VehicleSchema = new Schema({
licenseplate: {type: String, required: true, unique:true},
gpshits : [{
type: { type: String },
coordinates:[mongoose.Schema.Types.Mixed]
}]
},
{
timestamps: true
} …Run Code Online (Sandbox Code Playgroud)