Fix MongoDB projection error in uploadProofOfPayment
Fixed mixed inclusion/exclusion projection that caused error: "Cannot do inclusion on field bills.proofOfPayment.uploadedAt in exclusion projection" Changed projection to use exclusion-only: - Exclude bills.attachment (not needed in upload context) - Exclude bills.proofOfPayment.fileContentsBase64 (large file data) - Include all other fields implicitly (including uploadedAt for existence check) This reduces data transfer while maintaining MongoDB projection compatibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -511,10 +511,9 @@ export const uploadProofOfPayment = async (locationID: string, billID: string, f
|
||||
const dbClient = await getDbClient();
|
||||
|
||||
const projection = {
|
||||
// attachment is not required in this context - this will reduce data transfer
|
||||
"bills.attachment": 0,
|
||||
// don't include the attachment - save the bandwidth it's not needed here
|
||||
"bills.proofOfPayment.uploadedAt": 1,
|
||||
// ommit only the file contents - we need to know if a file was already uploaded
|
||||
// ommit file content - not needed here - this will reduce data transfer
|
||||
"bills.proofOfPayment.fileContentsBase64": 0,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user