开发者

JavaScript and Java Querying of CouchDb

开发者 https://www.devze.com 2023-04-12 06:20 出处:网络
I am looking at Couch Db and I saw Ektorp that presents a JPA like interface for database. However I see that there are examples that how to make query at JavaScript. I didn\'t understand how the syst

I am looking at Couch Db and I saw Ektorp that presents a JPA like interface for database. However I see that there are examples that how to make query at JavaScript. I didn't understand how the system work.

Do I query a database from web tier without a middle tier? How can sec开发者_JAVA技巧urity be done with that?


CouchDB uses javascript to define map and reduce functions for it's views. Ektorp is simply providing you a convenient way to create those functions that will be used by couchdb. You might want to read the couchdb wiki page on views:

http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views

Just because the views are javascript, does not imply that you have to create the views from a 'web tier'.

In terms of architecture, you have a couple of options. You can use a traditional three tier approach with a java front end, and in your middle tier call couchdb with ektorp. Then you are in full control of security.

You can also go with what is coming to be known as the 2.1 tier model, where users interact directly with couchdb, mainly with a couchapp. You can then provide support services that listen to the changes feed. I have done this with ektorp and it works very well. Other have used node.js. It is a different way of thinking, but it can work. You can read a fun post about this model here: http://markmail.org/thread/cfw7f3ef75aoqzin

Anyway, I just wanted to provide you with possible options in how you 'tier' your architecture.

0

精彩评论

暂无评论...
验证码 换一张
取 消