小编Pas*_*lly的帖子

你如何否定 mongodb 中的 $match 聚合

我有以下查询需要找到相反的查询。

db.contracts.aggregate([ 
    { $match: { currentBalance: { $gt: 0 }, status: 'open' } }, 
    { $project: { customer_id: 1, lastTransactionDate: 1, currentBalance: 1, status: 1 } }
])
Run Code Online (Sandbox Code Playgroud)

我试图不使用

$or: [ currentBalance: { $ne: 0 }, status: { $ne: 'open' } ]
Run Code Online (Sandbox Code Playgroud)

我真正想要的是使用,$not: [ condition ]因为我将有更难编写的聚合。但是我找不到正确的语法。任何帮助表示赞赏。我正在使用 mongodb 3.0.7

mongodb aggregation-framework

6
推荐指数
1
解决办法
5386
查看次数

如何从另一个工作流程启动一个工作流程并检索被调用工作流程的返回值

我正在测试谷歌工作流程,并想从另一个工作流程调用工作流程,但作为一个单独的流程(不是子工作流程)

我可以开始执行,但目前无法检索返回值。我收到了一个执行实例:

{
     "argument": "null",
     "name": "projects/xxxxxxxxxxxx/locations/us-central1/workflows/child-workflow/executions/9fb4aa01-2585-42e7-a79f-cfb4b57b22d4",
     "startTime": "2020-12-09T01:38:07.073406981Z",
     "state": "ACTIVE",
     "workflowRevisionId": "000003-cf3"
 }
Run Code Online (Sandbox Code Playgroud)

父工作流.yaml

main:
params: [args]

steps:
    
    - callChild:
        call: http.post
        args:
            url: 'https://workflowexecutions.googleapis.com/v1beta/projects/my-project/locations/us-central1/workflows/child-workflow/executions'
            auth: 
                type: OAuth2
                scope: 'https://www.googleapis.com/auth/cloud-platform'
        result: callresult
    
    - returnValue:
        return: ${callresult.body}
Run Code Online (Sandbox Code Playgroud)

子工作流.yaml:

 - getCurrentTime:
        call: http.get
        args:
            url: https://us-central1-workflowsample.cloudfunctions.net/datetime
        result: CurrentDateTime
    - readWikipedia:
        call: http.get
        args:
            url: https://en.wikipedia.org/w/api.php
            query:
                action: opensearch
                search: ${CurrentDateTime.body.dayOfTheWeek}
        result: WikiResult
    - returnOutput:
        return: ${WikiResult.body[1]}
Run Code Online (Sandbox Code Playgroud)

另外还有一个问题:如何从变量创建动态 url。${} 似乎在那里不起作用

google-workflows

3
推荐指数
1
解决办法
2432
查看次数