Why is Javascript used in MongoDB and CouchDB instead of other languages such as Java, C++?
Posted
by
startup007
on Programmers
See other posts from Programmers
or by startup007
Published on 2011-11-24T00:25:19Z
Indexed on
2011/11/24
2:20 UTC
Read the original article
Hit count: 303
java
|JavaScript
I asked this question on SO but was suggested to try here. So here it goes:
My understanding of Javascript so far has been that it is a client-side language that capture events and makes a web-page dynamic.
But on reading the comparison between MongoDB and CouchDB I noticed that both are using Javascript. This makes me wonder the reason behind the choice of JavaScript over other conventional languages.
I guess I am trying to understand the role of JavaScript and its advantages over other languages.
Update: I am not asking about the languages / drivers supported by the two databases. The comparison says:
Both CouchDB and MongoDB make use of Javascript. CouchDB uses Javascript extensively including in the building of views.
MongoDB also supports running arbitrary javascript functions server-side and uses javascript for map/reduce operations.
My lack of understanding pertains to why is Javascript being used at all for the backend work. Why is it preferred for building views in CouchDB, or for using map/reduce operations? Why C/C++ or Java were not used? What are the advantages in using Javascript for such back-end work?
© Programmers or respective owner