Announcement

Collapse
No announcement yet.

Console.log() equivalent in functions?

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Console.log() equivalent in functions?

    I haven't found much documentation on Navicat for MongoDB functions, but it seems that we can write plain Javascript code on them.

    When we have a loop (e.g. forEach after a find), is there any way to display some feedback while the process is running? (on nodejs I would do a console.log() with the item#, but console.log() is not accepted in functions).

    Thanks

  • #2
    Please try to use Print() in your function.e.g

    for (var i = 0; i < 10; i++) {
    print(i);
    sleep(1000)
    }

    After created the function, please execute it in Query like:

    db.loadServerScripts();
    function_name();

    Comment


    • #3
      Thanks mayho, this works and it is very helpful

      Comment

      Working...
      X