Saturday, February 18, 2012

Language candy and Mongo

Finished the implementation for MongoDB. Most Gyro features working with SQL are now working with MongoDB. Just faster. As a down side: no transactions, and different "cancel" behavior. For example, if we have an entity called "Post" and another one called "Comment" (related, one-to-any), on SQL, if the user modifies a comment and saves it, and the presses cancel on the parent object (Post), this causes a rollback for all the modified data in that transaction.

On NoSQL, same scenario, if a comment is modified, and then the parent is not saved, this will cause commit for the comment and rollback (emulated) for the post. Is not really a drawback, just a thing to keep in mind when designing your application.

I've introduced a new language core element: static key specification:
Something you used to do like this:

var arr0=new [];
arr0["key"]="some value";
arr0[3]="some index value";

// you can now do it like this:
var arr=["key" => "some value", 3 => "some index value"];
// or
// => and : are synonyms
var arr2=["key" : "some value", 3 : "some index value"];


Also, a new function (defined in standard.lang.serialize and Serializable.con): ToArray(object). This converts an object into an array, very useful for debugging, because you can now say:

echo ToArray(this);

GyroGears relations on MongoDB are now available using a mixed redundant relation/schema design. The related model is needed for maintaining Gyro-generated framework API compatibility with SQL design. The schema design is used for optimizing relation search. Yes, it is a little redundant, but it works very fast.

While implementing MongoDB driver, I've managed to identify a series of unreported bugs in GyroGears: revisions didn't work as expected for relations, some minor bugs in web search when searching by owner.

A new feature in GyroGears: View option for objects. All objects where opened in edit mode, this causing a locking of the record. Some times, the user just wanted to review the data, so the "View" menu option (when right clicking a record) opens a record in read only mode without locking.

I've made some preventive bug-fixing in Concept Server (automated tests), and MongoDB and MySQL driver.

Sunday, February 5, 2012

MongoDB is the first NoSQL supported database server

It's been a while since I've started pondering about the benefits of NoSQL database engines. After implementing more than 100 GyroGears solutions, I've started to notice some patterns suitable for no-sql engines.



I've finished all the preliminary tests for the MongoDB Concept driver, the auto-documentation is available here:

http://www.radgs.com/docs/help/MongoConnection.html
http://www.radgs.com/docs/help/MongoDataSet.html
http://www.radgs.com/docs/help/MongoCursor.html

And static functions here:
http://www.radgs.com/docs/help/standard.db.mongo.html

I've modified GyroGears to use this driver, though is not yet fully functional. The relations, files and multimedia types are not working properly yet.

Here is a screenshot of a GyroGears application running on MongoDB.



You can see that you can use sql-style wildcard (for backwards compatibility). You can regenerate your old SQL-based Gyro application for MongoDB without the end-user ever noticing.

Here is a shot of how the Mongo data looks like:


I've used MongoVUE, no Concept Application Server tool yet available for managing Mongo data.