Hi there!
i have data like this in my connected MongoDB collection "orders":
{
"_id": {
"$oid": "63fb69e083d79a02053fe0c2"
},
"meta": {
"address": {
"firstname": "Max",
"lastname": "Mustermann",
"name": "Max Mustermann",
"street": "Musterstraße 1",
"city": "Musterhausen",
"zip": "123456",
"countryCode": "DE",
"countryId": 1,
"phone": "0123456789",
"company": "",
"country": "Deutschland"
},
"confirmTime": "2023-02-26T14:17:03.211Z",
"branchProcessorId": 1234567,
"processor": {
"id": 101785,
"type": 4,
"inputs": {
"phone": "015228401129"
}
},
"payment": {
"isCashPayment": false,
"isPayed": true,
"isDemo": false
}
},
"order": {
"id": 9029395,
"uid": "54ec5159-8ccd-49b6-a153-e047561a1012",
"userId": 1083642,
"userPersonId": "123-456789",
"userName": "Max Mustermann",
"userFirstName": "Max",
"userLastName": "Mustermann",
"payerUserId": 12345678,
"payerUserPersonId": "112-345678",
"payerUserName": "Max Mustermann",
"payed": true,
"confirmed": true,
"articles": [
{
"id": 16561864,
"articleId": 1465417,
"amount": 1,
"name": "01 Margherita",
"options": [
{
"id": 7952747,
"optionId": 1465418,
"price": 0,
"name": "klein"
}
],
"price": 0,
"priceSum": 0,
"taxRate": 7
}
],
"subscriptions": [],
"sum": 0
},
"branch": {
"id": 123456
},
"__v": 0
}
I now want to use variables to specify a Date-Range in Metabase for showing me all orders in the defined date range:
[
{
"$match": {
"$expr": {
"$and": [
{
"$gte": [
{ "$dateFromString": { "dateString": "$meta.confirmTime" } },
{ "$dateFromString": { "dateString": "{{start_date}}" } }
]
},
{
"$lte": [
{ "$dateFromString": { "dateString": "$meta.confirmTime" } },
{ "$dateFromString": { "dateString": "{{end_date}}" } }
]
}
]
}
}
},
{
"$project": {
"_id": 0,
"confirmTime": "$meta.confirmTime",
"branchId": "$branch.id",
"payerUserName": "$order.payerUserName",
"articles": "$order.articles",
"orderSum": "$order.sum"
}
}
]
For this native query i´m getting "Invalid JSON number". Is this because metabase only submits date and not date-time format?
Variable type is: Date
Setting variable type to the specified field "meta.confirmTime" doesn´t makes any difference.
Any ideas?