From 2172fdc1d0717ab757ea63b7da928aa5c35c58d8 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Fri, 23 May 2025 15:59:56 -0400 Subject: [PATCH 1/4] updates --- components/mongodb/package.json | 2 +- .../sources/new-document/new-document.mjs | 24 +++++++++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/components/mongodb/package.json b/components/mongodb/package.json index d81276ff8cdc7..81c29d5f97493 100644 --- a/components/mongodb/package.json +++ b/components/mongodb/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/mongodb", - "version": "0.1.2", + "version": "0.1.3", "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 a9f2c929264f9..371bd2fc36c04 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.10", + version: "0.0.11", type: "source", dedupe: "unique", props: { @@ -29,7 +29,16 @@ export default { timestampField: { type: "string", label: "Timestamp Field", - description: "The key of a timestamp field, such as 'created_at' that is set to the current timestamp when a document is created. Must be of type Timestamp.", + description: "The key of a timestamp field, such as 'created_at' that is set to the current timestamp when a document is created.", + }, + timestampFieldType: { + type: "string", + label: "Timestamp Field Type", + description: "The type of the timestamp field", + options: [ + "Timestamp", + "Integer", + ], }, }, hooks: { @@ -49,6 +58,9 @@ export default { }, getTs(doc) { const tsValue = doc[this.timestampField]; + if (this.timestampFieldType === "Integer") { + return tsValue; + } if (typeof tsValue === "string") { return new Date(tsValue).getTime(); } @@ -77,14 +89,16 @@ export default { }; const query = { [this.timestampField]: { - $gt: this.convertToTimestamp(lastTs), + $gt: this.timestampFieldType === "Integer" + ? lastTs + : this.convertToTimestamp(lastTs), }, }; const documents = await collection.find(query).sort(sort) - .toArray(); + .toArray(); console.log(documents); const docs = []; for (const doc of documents) { - const ts = this.getTs(doc); + const ts = this.getTs(doc); console.log(ts); if (!(ts > lastTs) || (max && count >= max)) { break; } From ad11adc171f429cb04ac94610447548999736a98 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Fri, 23 May 2025 16:03:00 -0400 Subject: [PATCH 2/4] pnpm-lock.yaml --- pnpm-lock.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5afea2c286d05..655e8c12839fe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15484,14 +15484,6 @@ importers: specifier: ^6.0.0 version: 6.2.0 - modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/cjs: {} - - modelcontextprotocol/node_modules2/@modelcontextprotocol/sdk/dist/esm: {} - - modelcontextprotocol/node_modules2/zod-to-json-schema/dist/cjs: {} - - modelcontextprotocol/node_modules2/zod-to-json-schema/dist/esm: {} - packages/ai: dependencies: '@pipedream/sdk': From 956123ae77dc2d1d86b1e4009eff10464a775897 Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Fri, 23 May 2025 16:06:29 -0400 Subject: [PATCH 3/4] remove console.log --- components/mongodb/sources/new-document/new-document.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mongodb/sources/new-document/new-document.mjs b/components/mongodb/sources/new-document/new-document.mjs index 371bd2fc36c04..c9a033b1aec13 100644 --- a/components/mongodb/sources/new-document/new-document.mjs +++ b/components/mongodb/sources/new-document/new-document.mjs @@ -95,10 +95,10 @@ export default { }, }; const documents = await collection.find(query).sort(sort) - .toArray(); console.log(documents); + .toArray(); const docs = []; for (const doc of documents) { - const ts = this.getTs(doc); console.log(ts); + const ts = this.getTs(doc); if (!(ts > lastTs) || (max && count >= max)) { break; } From 9e3e650bdcd861b5f2462cfe8db1b016d476878a Mon Sep 17 00:00:00 2001 From: Michelle Bergeron Date: Fri, 23 May 2025 16:13:14 -0400 Subject: [PATCH 4/4] update --- components/mongodb/sources/new-document/new-document.mjs | 1 + 1 file changed, 1 insertion(+) diff --git a/components/mongodb/sources/new-document/new-document.mjs b/components/mongodb/sources/new-document/new-document.mjs index c9a033b1aec13..280196df36d14 100644 --- a/components/mongodb/sources/new-document/new-document.mjs +++ b/components/mongodb/sources/new-document/new-document.mjs @@ -35,6 +35,7 @@ export default { type: "string", label: "Timestamp Field Type", description: "The type of the timestamp field", + default: "Timestamp", options: [ "Timestamp", "Integer",