Announcement

Collapse
No announcement yet.

Console.log() equivalent in functions?

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

  • elaval
    started a topic Console.log() equivalent in functions?

    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

  • elaval
    replied
    Thanks mayho, this works and it is very helpful

    Leave a comment:


  • mayho
    replied
    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();

    Leave a comment:

Working...
X