-
Notifications
You must be signed in to change notification settings - Fork 16
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
Upsertion with projection: { _id: 0 }
appears broken
#1000
Comments
I think what’d be great would be actual JSON being sent: what is included looks more like Java/TypeScript Object and is missing possibly important information. For example, on request sent we have:
which is missing JSON Object contents, and the document that exists seems to not have |
@toptobes I created a test (#1026) that tries to do what you describe above (with the caveats that I may be missing information as per my earlier comment). Test passes, and I suspect that one of changes since your report has fixed the issue related to projection handling for this case. If you could retry test with the latest version of Data API as deployed that would be great: if the issue still persists, I'd need some more information, otherwise it can be closed. |
These should reproduce it? {
"insertOne": {
"document": {
"_id": 1
}
}
} {
"findOneAndReplace": {
"filter": {
"_id": 2
},
"replacement": {},
"options": {
"returnDocument": "before",
"upsert": true
},
"projection": {
"*": 0
}
}
} Projection can be either |
@toptobes Ok, hmmh. I used "_id": 0 projection in the test. I think the key is it needs to be anything but not the "default" projection, which is (or at least used to be) skipping part of processing. |
Hmm it seems to work fine when the projection is just await collection.insertOne({ _id: 1, john: '1' });
await collection.replaceOne(
{ _id: 2 },
{ john: '1' },
{ upsert: true, },
); |
Definitely sounds like applying any projection other than the new "include all" ( But I am not yet able to reproduce this against code in "main". Still trying. |
When doing
findOneAndReplace
withprojection: { _id: 0 }
, resulting in an upsert, the following is returned:where the data is interestingly non-null and the error field being quite... "internal"
Command sent:
The only document in the collection at the time (causing an upsert)
This may or may not happen with other commands as well, haven't tested.
The text was updated successfully, but these errors were encountered: