Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

C++/ulib-mongodb only making a single trip with its Update handler #2546

Closed

Description

@knewmanTE

I'm not particularly familiar with C++, but from what I can tell reading the ulib-mongodb Update handler, it looks like it's doing the following:

  1. Creating a Vector to hold up to 500 World objects
  2. Instantiating id and rnum variables
  3. Making a single call to both set id and rnum and update the database
  4. Creating a new world object from id and rnum
  5. Pushing the World object to the Vector
  6. Returning the Vector

There are a couple issues with this implementation:

  • The Update test specifies that you need to make 2 trips: one to retrieve an object from a random ID and one to update it in the database. So far as I can tell, this test is doing all of that in a single request.
  • It doesn't account for cases where the database request fails. I came to this conclusion in my testing in Remove capitalized mongo tables #2545. Because we are setting id and rnum within the updateOneBulk function call, even if the call fails, the variables are still updated, so the World object is instantiated without a hitch. This is definitely problematic, as it means that Travis could receive 500 {id, randomNumber} pairs back and emit a PASS when no items have actually been retrieved or updated in the database.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions