收藏
回答

databaseMigrateExport 如何加入指定条件下载部分数据问题?

databaseMigrateExport 的query参数里,where条件,怎么才能简便的传入多个条件参数呢

比如
collection= 'project'
wherekeys = {
  status:"审核不通过",
  name: "elaine",
  addr:"addr",
relationship:"本人",
project_types:"project",
branch:"company",
 }
这个wherekeys 是传参进来的,根据前台选择的导出条件来过滤

我试过这样的:
request.post(`https://api.weixin.qq.com/tcb/databasemigrateexport?access_token=${accessToken}`,
            {
                body: JSON.stringify({
                    env,
                    file_path: `${date}.csv`,
                    file_type: 2,
                    query: `db.collection("${collection}").where(${wherekeys}).field(${field}).get()`
                })
            },
但是这样一直报如下错误

{"errorCode":1,"errorMessage":"user code exception caught","stackTrace":"Error: 导出数据库异常:
创建数据库备份任务失败:SyntaxError: Line 1, column 36: Unexpected token 'identifier' TcbCode: [DATABASE_QUERY_PARSE_FAILED] 
rid: 625a2927-49fb4012-7967e310\n    at Runtime.exports.main [as handler] (/var/user/index.js:126:15)\n    
at processTicksAndRejections (internal/process/task_queues.js:97:5)","statusCode":430}

q请问大神是哪里出了问题,我要如何修改


回答关注问题邀请回答
收藏
登录 后发表内容