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

Effective Stored JavaScript in MongoDB

Vasil Remeniuk shares some tricks on working with MongoDB JavaScript:

This approach (nb: inlined JavaScript ) has two obvious drawbacks:

  1. Performance. Evaluated functions are not persisted between connects, therefore should be re-evaluated, which takes a lot of time (especially, if you deal with complex calls);
  2. Testability and readability. In-lined code is untestable and looks ugly.

[…]

First of all, all the in-lined JavaScript code should be moved to the place, where it should be – .js files on the classpath that can be tested (and mocked), and recognized by IDEs, which make them more comfortable to edit (because oh highlights, JavaDocs, autocompletion and other features we love our IDEs for).

via: http://vasilrem.com/blog/software-development/stored-javascript-in-mongo/