We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b3b0baa commit fc24e1cCopy full SHA for fc24e1c
packages/endpoint-media/lib/media-data.js
@@ -58,9 +58,10 @@ export const mediaData = {
58
59
const mediaData = { path, properties };
60
61
- // Add data to media collection (if present)
+ // Add data to media collection (or replace existing if present)
62
if (hasDatabase) {
63
- await media.insertOne(mediaData);
+ const query = { "properties.url": properties.url };
64
+ await media.replaceOne(query, mediaData, { upsert: true });
65
}
66
67
return mediaData;
0 commit comments