最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Is CouchDB an example of Server Side Javascript? - Stack Overflow

programmeradmin5浏览0评论

I looking at using Javascript server side and took a look at persevere/pintura but for a novice like me, I need more documentation and tutorials and CouchDB seems to have a lot of that but is it used as a server side js tool?

Kind Regards

I looking at using Javascript server side and took a look at persevere/pintura but for a novice like me, I need more documentation and tutorials and CouchDB seems to have a lot of that but is it used as a server side js tool?

Kind Regards

Share Improve this question edited Aug 19, 2010 at 20:20 John Topley 116k47 gold badges199 silver badges241 bronze badges asked Aug 19, 2010 at 20:16 RubyGladiatorRubyGladiator 1,7653 gold badges19 silver badges27 bronze badges 2
  • 1 Consider rethinking which of the answers is right one. – Nek Commented Jun 26, 2012 at 12:13
  • Nice to see the answer I consider the best checked :) – Nek Commented Jun 26, 2012 at 17:00
Add a ment  | 

5 Answers 5

Reset to default 6

Yes (seconding what @Pointy said above). The JavaScript in CouchDB does run server-side. :)

Beyond that, though, JavaScript in CouchDB can do far more than just map/reduce queries. It's also used for document validation, update handling (for processing XML POSTed to CouchDB for example), as well as HTML or other markup output from either a single JSON document (using _show) or from the results of a map/reduce query (using _list).

CouchDB does not, however, offer filesystem access or TCP/IP listeners as Node.js does. Right now, the JavaScript is focused on the "shipping and handling" for the database contents (things like validation, formatting, and querying).

If you're interested in looking into options for handling things that CouchDB doesn't do "internally" (image processing, sending e-mails, etc), you might checkout my reply about CouchApp architecture options.

CouchApp's are definitely a viable option for web apps. Coupling those with replication, it's hard to beat.

http://nodejs/ is a great example for server-side javascript. If you don't want to write your plete webapp on NodeJS you can trigger it via the node mand.

CouchDB is a database with an interresting feature, it allows you to interact via a RestFull api making it ideally suited to access over the web, either in javascript or other client environments. If you are looking for a server-side javascript development environment, try Servoy. It allows full featured server-side application development in javascript including easy database access to all major databases.

Short Answer: Yes.

Longer Answer:

There is a Javascript Engine shipped with CouchDB, which is SpiderMonkey (the very first engine, open source, written by Brendan Eich, creator of javascript)

CouchDB's View function is JavaScript function running server side that acts as the Map half of a map/reduce operation to construct view.

Then there is client side javascript API, which can be used to municate with the REST layer to fetch/update documents, which is also where jQuery is used by CouchDB.

More on CouchDB's both server-side & client side javascript capability:

The default engine is capable of doing many features, while package availability is limited pared to Node.js. Kan.so can be considered "NPM for CouchDB, where some packages are server side. For example, there are frameworks like duality that try to make use of both server side & client side javascript capability to reuse code for rendering with couchDB.

More on the engine:

(The selection of spider Monkey over v8 is because for couchDB's use case the map reduce is not v8 designed for. Also include packaging, multi-threading and also historical reason v8 did not exist that time when spiderMoney is chosen) see [the mailing list] and tweet2

There is even project to port the whole CouchDB to Node.js (i.e. instead of Erlang), Chesterfield

I am glad if someone can add how Erlang talk with the javscript engine. Thanks for everyone's answer, this is an important thing to make clear for people like me messing up couchDB with some Node.js packages

No, CouchDB is a document-oriented database that can be queried and indexed in a MapReduce fashion using JavaScript. CouchDB also offers incremental replication with bi-directional conflict detection and resolution.

http://couchdb.apache/

CommonJS can be used for server side JavaScript, see here: http://www.monjs/

NodeJS is another: http://nodejs/

发布评论

评论列表(0)

  1. 暂无评论