Coder Lounge - January 2014
MongoDB
Today at Coder Lounge we looked into MongoDB for the storage and retrieval of large amounts of data. MongoDB is one of the most straight forward technologies we've recently come across to use. It stores data as JSON objects and queries of the data are done in JavaScript and we have some specific questions we want to hopefully answer.
Is it fast for queries?
From our limited testing this evening we would say its just as fast as SQL for the kind of queries we ran. Reading further it looks like where MongoDB wins is around write speed if you have a dataset where you do a lot of writing.
Is it hard to use / query?
The Syntax is JavaScript. This means you can do some pretty complex stuff right down to writing functions and beyond... without breaking a sweat! What's more, these functions can live with the rest of your code and not on the MongoDB server. For us as developers, JavaScript seems a more natural language to use than SQL or Lucene.
Is the data that comes back hard to parse?
Not at all. MongoDB gives you an iterator object which returns objects via the mongo PHP extension. It is very easy to parse as there is no need to transform the data when you receive it, because it is already an object. Behat Mike Davis spent more time learning the drupalextension module as an alternative to our own Behat Testing module. The benefit here is that the the Drupal Extension module has a wider usage base so it makes sense to collaborate with them on improving it rather than maintaining our own implementation.
Time based node access module
Solutions Architect Steve Coppin been working on a module to limit access to a node, based on visits to nodes of that type during a time frame, configured by role. The purpose is to create a teasing mechanism to allow access to say three articles in 24 hours and on the fourth redirecting to a subscription page. It’s just being tidied and will be put in a sandbox module shortly.
CKEditor
Developer Dan James has been investigating better ways of embedding media tags with CKEditor 4 and the media module. He is also looking at a way to embed private files into a node and have the file permissions carry from the node. More on this to follow!