mwg9r5ms1#
类似于这样:"query":"{created_at:{ $gte: '''${begin_time}''', $lte: '''${end_time}''' }}",begintime和endtime是我定义在外面的变量,亲测有效
ycl3bljg2#
"column": [{"index":0,"name": "_id","type": "string"},{"index":1,"name": "uid","type": "String"},{"index":2,"name": "taskCode","type": "string"},{"index":3,"name": "taskName","type": "string"},{"index":4,"name": "rewardType","type": "Int"},{"index":5,"name": "rewardContentId","type": "string"},{"index":6,"name": "terminal","type": "Int"},{"index":7,"name": "desc","type": "string"},{"index":8,"name": "createTime","type": "Date"}],"query":"{createTime:{ $gte: ${t1}, $lte: ${t2} }}"}
你好,我模仿了你的写法,但是一条数据都没有查出来,mogodb是ISOdate格式,${t1}取得的值是1622995200101,我t1的变量这样直接用时间戳可以吗,现在一条数据也没有查到...求助
2条答案
按热度按时间mwg9r5ms1#
类似于这样:"query":"{created_at:{ $gte: '''${begin_time}''', $lte: '''${end_time}''' }}",
begintime和endtime是我定义在外面的变量,亲测有效
ycl3bljg2#
"column": [
{
"index":0,
"name": "_id",
"type": "string"
},
{
"index":1,
"name": "uid",
"type": "String"
},
{
"index":2,
"name": "taskCode",
"type": "string"
},
{
"index":3,
"name": "taskName",
"type": "string"
},
{
"index":4,
"name": "rewardType",
"type": "Int"
},
{
"index":5,
"name": "rewardContentId",
"type": "string"
},
{
"index":6,
"name": "terminal",
"type": "Int"
},
{
"index":7,
"name": "desc",
"type": "string"
},
{
"index":8,
"name": "createTime",
"type": "Date"
}
],
"query":"{createTime:{ $gte: ${t1}, $lte: ${t2} }}"
}
你好,我模仿了你的写法,但是一条数据都没有查出来,mogodb是ISOdate格式,${t1}取得的值是1622995200101,我t1的变量这样直接用时间戳可以吗,现在一条数据也没有查到...求助