We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The bulk result structure does not contain UpsertedIDs, so it is impossible to know what IDs were inserted when upserting using bulk upsert.
The fact that this feature is missing is a problem for requests such as the following one, when I want to do something with IDs that were inserted.
db.my_collection.bulkWrite([{"updateOne": {"filter": {"not_id_field" : "10000000"}, "update": {"$setOnInsert": {"_id": "some_random_id"},"$addToSet": {"other_field": {"$each": ["100"]}}}, "upsert": true }}])
{ "acknowledged" : true, "deletedCount" : 0, "insertedCount" : 0, "matchedCount" : 0, "upsertedCount" : 1, "insertedIds" : {}, "upsertedIds" : { "0" : "some_random_id" } }
Request result comes from Mongo 4.0.6 EDIT: The request result is the same using Mongo 3.6.8
Wouldn't it be more complicated than just adding the upsertedIDs field in BulkUpdate structure and using the field in the Bulk's runUpdate method?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The bulk result structure does not contain UpsertedIDs, so it is impossible to know what IDs were inserted when upserting using bulk upsert.
The fact that this feature is missing is a problem for requests such as the following one, when I want to do something with IDs that were inserted.
db.my_collection.bulkWrite([{"updateOne": {"filter": {"not_id_field" : "10000000"}, "update": {"$setOnInsert": {"_id": "some_random_id"},"$addToSet": {"other_field": {"$each": ["100"]}}}, "upsert": true }}])
{ "acknowledged" : true, "deletedCount" : 0, "insertedCount" : 0, "matchedCount" : 0, "upsertedCount" : 1, "insertedIds" : {}, "upsertedIds" : { "0" : "some_random_id" } }
Request result comes from Mongo 4.0.6
EDIT: The request result is the same using Mongo 3.6.8
Wouldn't it be more complicated than just adding the upsertedIDs field in BulkUpdate structure and using the field in the Bulk's runUpdate method?
The text was updated successfully, but these errors were encountered: