Javascript animate json data on loop


I’m testing out a Realm app with a database from Atlas.

I have a GET webhook exposing the entire database as an array, but need the database to be output in a single field as an animation loop sequence (like a stop watch counter.)

Here is the function I’m working on:

exports = function(payload) {

 const mongodb ="mongodb-atlas");

 const mycollection = mongodb.db("mydatabase2").collection("mycollection2");

 return mycollection.find({}, {_id:0}).toArray();


and the webhook database output as static array, instead of animation loop.

Please help, I am still learning) and would love to make use of MongoDBxRealm apps properly!

Many thanks, Andi


So instead of exposing the entire database as a static array:


The webhook will loop through the database infinitely as an animated sequence shown as a single field:


Thank you!

Hi @a_Jn,

The webhook is designed to output a static value and it cannot animate your front end result.

What you need is to write a front end code that with a setTimeout will get the next value and update the screen output and as a result does this animation.


1 Like

Thank you Pavel, this sounds like a good solution!

1 Like