I am using mongoDB input step in my transformation and the query i am using is not working. On mongoplayground and compass the query works fine, however the exact same query on kettle gives the following error
2020/11/26 11:41:10 - file:///home/stqa/Documents/PDI Transformations/Allticket.ktr : Allticket - Dispatching started for transformation [file:///home/stqa/Documents/PDI Transformations/Allticket.ktr : Allticket]
2020/11/26 11:41:10 - Get Data.0 - Normal authentication for user admin
2020/11/26 11:41:10 - Get Data.0 - Configuring connection with read preference: primary
2020/11/26 11:41:10 - Get Data.0 - No read preference tag sets defined
2020/11/26 11:41:10 - Get Data.0 - Configuring connection with write concern - w = 1, wTimeout = 0, journaled = false
2020/11/26 11:41:10 - Get Data.0 - ERROR (version 9.1.0.0-324, build 9.1.0.0-324 from 2020-09-07 05.09.05 by buildguy) : Unexpected error
2020/11/26 11:41:10 - Get Data.0 - ERROR (version 9.1.0.0-324, build 9.1.0.0-324 from 2020-09-07 05.09.05 by buildguy) : org.pentaho.di.core.exception.KettleException:
2020/11/26 11:41:10 - Get Data.0 - com.mongodb.util.JSONParseException:
2020/11/26 11:41:10 - Get Data.0 - {$match: { ticket_date : { $gte : new Date("2020-11-26")}}}
2020/11/26 11:41:10 - Get Data.0 - ^
2020/11/26 11:41:10 - Get Data.0 -
2020/11/26 11:41:10 - Get Data.0 - {$match: { ticket_date : { $gte : new Date("2020-11-26")}}}
2020/11/26 11:41:10 - Get Data.0 - ^
2020/11/26 11:41:10 - Get Data.0 -
2020/11/26 11:41:10 - Get Data.0 - at org.pentaho.di.trans.steps.mongodbinput.MongoDbInput.processRow(MongoDbInput.java:137)
2020/11/26 11:41:10 - Get Data.0 - at org.pentaho.di.trans.step.RunThread.run(RunThread.java:62)
2020/11/26 11:41:10 - Get Data.0 - at java.lang.Thread.run(Thread.java:748)
2020/11/26 11:41:10 - Get Data.0 - Caused by: com.mongodb.util.JSONParseException:
2020/11/26 11:41:10 - Get Data.0 - {$match: { ticket_date : { $gte : new Date("2020-11-26")}}}
2020/11/26 11:41:10 - Get Data.0 - ^
This error comes when i add the date match condition.I have tried new Date, ISOdate, encasing date in quotes, putting the match condition at different locations in the aggregate query etc. nothing is working
db.collection.aggregate([
{
$addFields: {
content: {
$cond: [
{
$eq: [
{
$type: "$content"
},
"array"
]
},
{
$trim: {
input: {
$reduce: {
input: "$content",
initialValue: "",
in: {
$concat: [
"$$value",
" ",
"$$this"
]
}
}
}
}
},
"$content"
]
}
}
},
{
$project: {
heading: 1,
content: 1,
source: 1,
ticket_date: 1,
lang: 1
}
},
{
$match: {
ticket_date: {
$gte: new Date("2020-11-24")
}
}
}
])