Skip to content

Instantly share code, notes, and snippets.

@djamol
Last active April 17, 2023 07:20
Show Gist options
  • Save djamol/67a6b46a1f4f5dc8755d1054502af0d8 to your computer and use it in GitHub Desktop.
Save djamol/67a6b46a1f4f5dc8755d1054502af0d8 to your computer and use it in GitHub Desktop.
{
"api": "API",
"query": [
{
"$match": {
"input": "hi"
}
},
{
"$project": {
"myTimestamp": {
"$dateToString": {
"format": "%Y-%m-%d %H:%M:%S",
"date": {
"$add": [
{
"$toDate": "$created_at"
},
19800000
]
},
"timezone": "+05:30"
}
},
"created_at": 1,
"output": 1,
"input2": "$input"
}
}
]
}
@djamol
Copy link
Author

djamol commented Apr 17, 2023

$match: {
      date: {
        $gte: ISODate("2023-04-16T00:00:00.000Z"),
        $lte: ISODate("2023-04-17T00:00:00.000Z")
      }
    },
{
    $group: {
      _id: "$user_id",
      count: { $sum: 1 }
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment