Mongoose查找查询将默认值返回到最近添加的字段

时间:2017-06-28 12:31:31

标签: mongoose

var cursor = this.find(query).select({
"alias": 1,
"To": 1,
"city": 1,
"state": 1,
"cdr": 1,
"RecordUrl": 1,
"From": 1,
"Digits": 1,
"bundle": 1,
"callResult": 1,
"advivrDuration": 1,
"connectDuration": 1,
"Duration": 1,
"StartTime": 1,
"comment": 1,
"zipcode": 1,
}).sort({ StartTimeNumberEST: -1 }).hint({ StartTimeNumberEST: 1 }).lean().cursor();

以前,这个查询现在是下面的一个

var cursor = this.find(query).select({
"alias": 1,
"To": 1,
"city": 1,
"state": 1,
"cdr": 1,
"RecordUrl": 1,
"From": 1,
"Digits": 1,
"bundle": 1,
"callResult": 1,
"advivrDuration": 1,
"connectDuration": 1,
"Duration": 1,
"StartTime": 1,
"comment": 1,
"zipcode": 1,
"cpa": 1
}).sort({ StartTimeNumberEST: -1 }).hint({ StartTimeNumberEST: 1 }).lean().cursor();

面临的问题是添加cpa后要添加到数据中cpa始终是默认值 它没有向我发送数据库中的确切值 对mongo db很新的人。

架构:

var Trans = new Mongoose.Schema({
_id: { type: String, required: true, unique: true },
transaction_id: { type: String },
corrects_transaction_id: { type: String },
original_order_id: { type: String },
complete_call_id: { type: String },
start_time_local: { type: Date },
start_time_xml: { type: Date },
StartTime: { type: String },
StartTimeNumberEST: { type: SchemaTypes.Long, min: 0, default: 0 },
StartTimeHour: { type: Number },
StartTimeDay: { type: String },
AnswerTime: { type: Date },
CustomeIvrTime: { type: Date },
EndTime: { type: Date },
corrected_at: { type: String },
offer: { type: String },
alias: { type: String },
tempoffer: { type: String },
cdr: { type: String },
bundle: { type: String },
From: { type: String },
To: { type: String },
callPromo: { type: String },
mobile: { type: String },
routed_to_number: { type: String },
city: { type: String },
state: { type: String },
zipcode: { type: String },
Digits: { type: String },
Duration: { type: Number },
connectDuration: { type: Number, default: 0 },
customivrDuration: { type: Number },
advivrDuration: { type: Number, default: 0 },
callResult: { type: String },
allCallResult: { type: String },
RecordingID: { type: String },
RecordUrl: { type: String },
cpa: { type: Number, default: 0 },
TotalCost: { type: Number },
BillDuration: { type: Number },
BillRate: { type: Number },
HangupCause: { type: String },
Direction: { type: String },
CallStatus: { type: String },
Event: { type: String },
media_type: { type: String },
transcription: { type: String },
affiliate_payout_localized: { type: String },
matching_affiliate_payout_policies: { type: String },
payout_conditions: { type: String },
opt_in_SMS: { type: Number },
transfer_from_type: { type: String },
comment: { type: String },

});

0 个答案:

没有答案