-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Admin, JavaScript
-
None
-
Fully Compatible
When driving configuration from script files, there are a few places – such as when a cluster is starting up, or when an election is taking place – when the cluster passes through a series of relatively long-running state changes, and the script cannot continue until those changes have completed. The scripting interface provided is JavaScript; unfortunately, it is not practical to block in JavaScript, nor are any callbacks provided. We have only a few fallbacks, none of them great:
- Break the JavaScript into several pieces, invoke them separately from shell scripts, and wait in the shell scripts. Requires polling.
- Aggressively busy wait in the JavaScript.
- Write all of this simple setup code in Java or another more-powerful programming language.
It would be more convenient if we could either (1) choose to have mongo itself block until the full state change is complete, or (2) receive a callback when the operation is finished.