apache / apache/openwhisk-package-cloudant

Specify doc id as parameter outside of doc body when creating doc via write action

Open
#109 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
17
Forks
31
PR merge metrics
No merged PRs in 30d

Description

I'm trying to build a sequence of actions where one action produces:

```
{
"doc": {
"IsTruncated": false,
"Marker": null,
"Users": [
{
"Arn": "arn:aws:iam::9798798:user/some.user@yourcompany.co",
"CreateDate": "2016-01-11T23:49:40Z",
"PasswordLastUsed": "2017-06-07T17:41:08Z",
"Path": "/",
"UserId": "ERXEAIDAHGJJK87878KKW",
"UserName": "some.user@yourcompany.co"
},
...
]
}
```

and the output is connected to a cloudant `write` action.

Everything works, however it creates a new unique doc id every time the action sequence is invoked, which isn't what I want in this case. The only way that I can tell to have it write to the same doc id is to modify the upstream action to produce:

```
{
"doc": {
"_id": "aws_user_list",
"IsTruncated": false,
"Marker": null,
"Users": [
{
"Arn": "arn:aws:iam::9798798:user/some.user@yourcompany.co",
"CreateDate": "2016-01-11T23:49:40Z",
"PasswordLastUsed": "2017-06-07T17:41:08Z",
"Path": "/",
"UserId": "ERXEAIDAHGJJK87878KKW",
"UserName": "some.user@yourcompany.co"
},
...
]
}
```

It would be a "nice-to-have" option to be able to bind the doc id parameter to a cloudantdb write action so that when I call the action it will use that doc id, rather than having to include the `_id` parameter in the doc contents.

Actually I just realized this is assuming it's even possible to create an action based on an existing cloudant write action and bind extra parameters to it. I'm not sure how to do that, but I thought I remember reading that it was possible.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.