Skip to content

Commit 3a93dad

Browse files
convert timestamp correctly if iso string
1 parent f2598e8 commit 3a93dad

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

components/mongodb/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/mongodb",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "Pipedream MongoDB Components",
55
"main": "mongodb.app.mjs",
66
"keywords": [

components/mongodb/sources/new-document/new-document.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default {
66
key: "mongodb-new-document",
77
name: "New Document",
88
description: "Emit new an event when a new document is added to a collection",
9-
version: "0.0.9",
9+
version: "0.0.10",
1010
type: "source",
1111
dedupe: "unique",
1212
props: {
@@ -48,10 +48,14 @@ export default {
4848
this.db.set("lastTs", lastTs);
4949
},
5050
getTs(doc) {
51+
const tsValue = doc[this.timestampField];
52+
if (typeof tsValue === "string") {
53+
return new Date(tsValue).getTime();
54+
}
5155
try {
52-
return JSON.parse(doc[this.timestampField]);
56+
return JSON.parse(tsValue);
5357
} catch {
54-
return doc[this.timestampField];
58+
return tsValue;
5559
}
5660
},
5761
convertToTimestamp(timestampStr) {

0 commit comments

Comments
 (0)