I need to process 100s of Gigas of DB on the Server Side and the way I'm doing it right now is by loading a JS file with the shell.
i.e: mongo ipaddress:27017/database_name script.js
This works fine but problem is I can see that the data is being processed on the MongoDB shell in the CLIENT side, and all the data is passed through the network (which is a big overhead we would rather avoid).
Is there any way to process the data ONLY on the server side, without transferring all the data ?
Thanks a lot.
Hi Joachim,
I need to process 100s of Gigas of DB on the Server Side and the way I’m doing it right now is by loading a JS file with the shell.
i.e: mongo ipaddress:27017/database_name script.js
Is there any way to process the data ONLY on the server side, without transferring all the data ?
You can open the mongo
shell directly on the server so that the script.js
file will be executed on the server, as described in Running .js files via a mongo shell Instance on the Server.
For example, you can:
script.js
to the serverssh
directly into itmongo localhost:27017/database_name script.js
Since the mongo
shell is opened on the server, the script will run on it.
The tradeoff is that while the script is running, it will create a resource contention in the server with the mongod
process. Please ensure that this tradeoff is acceptable before deploying this method into production.
Best regards.
Kevin