Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk Upsert is not working #17054

Closed
6 tasks
harikapampatti opened this issue Aug 24, 2021 · 1 comment
Closed
6 tasks

Bulk Upsert is not working #17054

harikapampatti opened this issue Aug 24, 2021 · 1 comment
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@harikapampatti
Copy link

  • Package Name:
  • Package Version:
  • Operating system:
  • nodejs
    • version:
  • browser
    • name/version:
  • typescript
    • version:
  • Is the bug related to documentation in

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:
1.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Hi Team,

I need to update one of the attribute in cosmosdb.
So iam fetching all the records from db and updating the property and using bulk executor to update the records.

but records are not getting updated in cosmosdb and there are no errors.

Below is my code

  var createdContainer = rbacClient.database(DB_NAME).container(containerId)

    const queryIterator = createdContainer.items.query('SELECT * FROM c where c.xxx= "xxxx"')
    let { resources: results } = await queryIterator.fetchAll();
    console.log(results.length, '->Total records ')

    results.forEach(document => {
            document.xxxx = "00";  
    })

In the above code iam fetching the records and setting the property to "00"

 while (i) {

            var pos = data.length - i;
            var superItem = data[pos];
            superItem.id = data[pos].articleNumber;
            // console.log(data[pos].id, ' data[pos].id')

            operations.push({
                operationType: "Upsert",
                resourceBody: superItem,
                partitionKey : superItem.id
            });
            if (i % 100 == 0 || i == 1) {

                      var response = await container.items.bulk(operations, { continueOnError: true });


                operations = [];
               
            }

            i--;
            if (i === 0) {
                console.log('100 records got deleted')
            }
        }

Above code is to update the records but the records are not getting updated.

Please help me to resolve this asas.

@ghost ghost added needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Aug 24, 2021
@harikapampatti
Copy link
Author

this working as expected hence closing

openapi-sdkautomation bot pushed a commit to AzureSDKAutomation/azure-sdk-for-js that referenced this issue Dec 13, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

1 participant