Inspire EMEA 2022 On-Demand is live! Watch now, and be sure to save the date for Inspire 2023 in Las Vegas next May.

Alteryx Server Discussions

Find answers, ask questions, and share expertise about Alteryx Server.

AlteryxService query MongoDB

8 - Asteroid

I am trying to query the MongoDB backend of Alteryx using Studio 3T to connect. The collection I am interested in is the AS_Queue, how can I grab the jobs completed in the last hour?



A bit of back story, I want to run a batch query from AWS to a database/lambda to check the DB for number of nodes running and length of jobs in queue to send out alerts if a node goes down (we have 3) or a job extends past a certain run time as an early alerting process.


Hi @GoldenDesign04 - check out this article for How to Efficiently Query MongoDB . Section f. "Query based on a relative date (objects created in the last X days, as an example)" should help you achieve what you're looking to accomplish.

8 - Asteroid

Thanks Dana for the response. The issue unfortunately is even listed in that link. Alteryx database classifies all the date/time stamps as strings so the query in F won't work.


I did however get a query to work using Studio 3T (Mongdb query tool) and set a scheduled task to pull the date/time I was hoping. 



today = new Date();
today.setHours(0, 0, 0, 0);
startOfDay = today.toISOString()
.slice(0, -5)
.replace(/T/g, match => match === 'T' ? ' ' : '');
end = new Date();
end.setHours(23, 59, 59, 999);
endOfDay = end.toISOString()
.slice(0, -5)
.replace(/T/g, match => match === 'T' ? ' ' : '');
"CreationDateTime": {
$gt: startOfDay,
$lt: endOfDay