ALL COVERED TOPICS

NoSQL Benchmarks NoSQL use cases NoSQL Videos NoSQL Hybrid Solutions NoSQL Presentations Big Data Hadoop MapReduce Pig Hive Flume Oozie Sqoop HDFS ZooKeeper Cascading Cascalog BigTable Cassandra HBase Hypertable Couchbase CouchDB MongoDB OrientDB RavenDB Jackrabbit Terrastore Amazon DynamoDB Redis Riak Project Voldemort Tokyo Cabinet Kyoto Cabinet memcached Amazon SimpleDB Datomic MemcacheDB M/DB GT.M Amazon Dynamo Dynomite Mnesia Yahoo! PNUTS/Sherpa Neo4j InfoGrid Sones GraphDB InfiniteGraph AllegroGraph MarkLogic Clustrix CouchDB Case Studies MongoDB Case Studies NoSQL at Adobe NoSQL at Facebook NoSQL at Twitter

NAVIGATE MAIN CATEGORIES

Close

JavaScript: All content tagged as JavaScript in NoSQL databases and polyglot persistence

MongoDB and the JavaScript Shell

If you’ve watched any of the MongoDB screencasts[1] you’ve probably already noticed the usage of the MongoDB interactive shell[2]. Recently, Mike Dirolf (@mdirolf) has published an ☞ article covering some of the details of the JavaScript based MongoDB interactive shell:

The embedded interpreter is used in all sorts of different ways, including for Map/Reduce, db.eval, and $where clauses. One nice feature supported by MongoDB is the ability to store JS functions on the server.

In ☞ an interview with the guys over ☞ The BitSource, Mike Dirolf commented about the MongoDB shell:

Q: Why write a shell in Javascript?

M.D.: We wanted the shell to be a full programming environment, a “real” programming language. That makes a lot of administrative tasks much easier. It also allows us to use it for automated testing and a wide variety of other use cases.

Once that decision was made the options were to invent our own language or pick an existing one. JavaScript is a good choice because it is flexible, full-featured, and widely known. Most web developers have at least a passing familiarity with JavaScript, if not deep expertise. It’s sort of a least common denominator programming language for the web, and that makes it a good choice for a general purpose tool like our shell.

Q: What is one cool thing it can do?

M.D.: The shell can do a lot of cool things – it’s a full MongoDB client! It can be used to perform any of the operations supported by any of the other MongoDB rivers, and you can do them from a nice REPL. This makes it incredibly easy to use for administration and just playing around with MongoDB.

Q: What is one thing the Javascript shell does exceptionally better than other code of it’s type? Would Oracle’s sqlplus be the comparison of the Javascript shell in MongoDB, for example?

M.D.: Yeah I think those are comparable. The really nice thing about the shell compared to other DB shells is that it is really a fully functioning programming language. You can do all sorts of interesting things by leveraging that fact – you can write real programs to do administrative tasks.

We should note that there are more NoSQL projects using JavaScript for server side work (f.e. CouchDB and Riak), while ☞ others are looking into some more exotic options like Tcl.

References


A NoSQL Use Case: URL Shorteners

Last week, I have mentioned a post by Gleicon Moraes on ☞ building an URL shortener using MongoDB and alternatively Redis.

There is also a ☞ GitHub project by Sean Cribbs implementing the same scenario using Riak and Ruby-based Sinatra.

Update: Jan Lehnardt was quick to point me to a CouchDB-based URL shortner on ☞ GitHub.

Update 2: Mathias Meyer shared with us ☞ Relink: a solution built on top of Redis with Sinatra

Update 3: Aaron pointed out ☞ little, another solution using Redis and Node.js

Update 4: Frank Denis has just pushed live ☞ the code of another URL shortener ☞ http://sk.tl, built using Tokyo Cabinet and Sinatra. Thanks Frank!

I’m pretty sure there are many more such projects so please post a link to the project in the comment section and I’ll update the post.


Using Google's V8 JavaScript Engine with MongoDB

Purely geeky: learn how to use the Google V8 JavaScript engine with MongoDB.

Currently the JavaScript engine used is spider monkey (Developed by Mozilla). If you checkout the lastest version of mongoDB you will be able to build it with Google’s V8 JavaScript engine support.

The installation details are for Ubuntu, but who knows maybe somebody can get this to work on Mac OS too.

via: http://www.howsthe.com/blog/2010/feb/22/mongodb-and-v8/


Play with Taskr: A Lightweight CouchApp Task Tracker

Chris Anderson (@jchris) has shared a 10min video demoing Taskr, a lightweight task tracker that uses some new plugins (Evently and Pathbinder) available through CouchApp[1]. The video is pretty fun, unfortunately the fonts are too small to see the code, so you’ll have to check out the ☞ GitHub code to follow along.

And hello Chris from MyNoSQL!

References

  • [1] ☞ CouchApp provides a set of utilities making standalone CouchDB app simple. ()

Charts with Redis and RaphaelJS

A couple of interesting tips of putting Redis to work to get charts and reports:

  • using “smart” keys for storing data in Redis
  • retrieve all keys using a pattern (note: as pointed out in the article this is not really recommended, except the case where the key space is reduced in size)
  • using existing Redis commands for getting set length, instead of fetching and counting

“Elementary, my dear Watson”.

Related to last point, I have found this ☞ old post on the Redis mailing list suggesting the unification of all Redis size-related commands: LLEN, SCARD, ZCARD, etc. and I must confess that I kind of like the suggestion.

As a side note, this other ☞ post, promising to tell more about reporting in NoSQL got me really confused.

Update: Just found another ☞ article presenting a reporting solution based on the ☞ Event Sourcing pattern. While it looks interesting, I’m wondering if for high volume data this would not be overkill though.

via: http://masonoise.wordpress.com/2010/02/05/making-a-quick-chart-with-raphaeljs-and-redis/