我正在尝试从约会表中获取一些数据。但是当执行以下代码时,数据无法获取。在我的mongo中,我有匹配标准的数据。任何帮助将不胜感激。 任何人都可以检查我给出的对错条件。
var timePeriod = {
to: 1512412200000,
from: 1511807400000
}
var List= appointment.find({$and:[{‘appointmentDate’:
{$gte:Number(timePeriod.from)}},{‘appointmentDate’:
{lte:Number(timePeriod.to)}},
{‘url’:{$eq:‘boaseenterprises.ezvisitor.com’}}]}).fetch();
mongo collection data
{
"_id" : “SpwCxi4CsxDFanvrf”,
“appointmentDate” : 1511952239000.0,
“appointmentTime” : 1511952239000.0,
“appointmentEndDate” : 1511955839000.0,
“appointmentEndTime” : 1511955839000.0,
“purpose” : “t”,
“hostName” : “boase”,
“status” : “pending”,
“hostId” : “Tct2pRanpHW5pju6A”,
“url” : “boaseenterprises.ezvisitor.com”,
“visitorsList” : [
{
“id” : “9i8u9tFwyuFi7xjmE”,
“name” : “test1”,
“signIn” : 0,
“signOut” : 0
}
]
}
答案 0 :(得分:1)
查看您的查询,您正在尝试查找timePeriod.from
和timePeriod.to
之间的所有约会,其中网址为boaseenterprises.ezvisitor.com
appointment.find({
appointmentDate: {$gte:timeperiod.from},
appointmentDate: {$lt:timePeriod.to},
url : "boaseenterprises.ezvisitor.com"
}).fetch();