diff --git a/components/mongodb/package.json b/components/mongodb/package.json index a2de271d2c20c..d81276ff8cdc7 100644 --- a/components/mongodb/package.json +++ b/components/mongodb/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/mongodb", - "version": "0.1.1", + "version": "0.1.2", "description": "Pipedream MongoDB Components", "main": "mongodb.app.mjs", "keywords": [ diff --git a/components/mongodb/sources/new-document/new-document.mjs b/components/mongodb/sources/new-document/new-document.mjs index c81ce914ce97c..a9f2c929264f9 100644 --- a/components/mongodb/sources/new-document/new-document.mjs +++ b/components/mongodb/sources/new-document/new-document.mjs @@ -6,7 +6,7 @@ export default { key: "mongodb-new-document", name: "New Document", description: "Emit new an event when a new document is added to a collection", - version: "0.0.9", + version: "0.0.10", type: "source", dedupe: "unique", props: { @@ -48,10 +48,14 @@ export default { this.db.set("lastTs", lastTs); }, getTs(doc) { + const tsValue = doc[this.timestampField]; + if (typeof tsValue === "string") { + return new Date(tsValue).getTime(); + } try { - return JSON.parse(doc[this.timestampField]); + return JSON.parse(tsValue); } catch { - return doc[this.timestampField]; + return tsValue; } }, convertToTimestamp(timestampStr) {