Blender experiments / MongoDB

Here is a picture that I made following these video tutorials ([1], [2]).

clock

I intend to start looking at these tutorials next on handling splash in blender, by the same person ([1], [2]).

Changing the subject, I’m still very muddled with the MongoDB / mySQL dichotomy, and suspect that I might need to revise my views as stated in my previous post to reflect this.  However I did find an excellent presentation on MongoDB many-to-many relationships, and how the schema model is different, here.

Essentially, this seems to be the key difference of relevance to my investigations:

  • in MongoDB there are no joins, but data is “embedded and linked”

One-to-many is arranged by referencing tables by id, eg:

blogs :
 { author : "Herge",
   date : "Sat Jul 24 2010 19:47:11 GMT-0700 (PDT)"
   comments : [
    {comment : ObjectId("1") } ]}

comments :
 { _id : "1",
   author : "James",
   date : "Sat Jul 24 2010 20:51:03 ..." }

For many-to-many, a similar idea is used, but this time, the linking goes both ways:

products :
 { _id : ObjectId("10"),
   name : "Destination Moon",
   category_ids : [ ObjectId("20"),
                    ObjectId("30")]}

categories :
  { _id : ObjectId("20"),
   name : "adventure",
   product_ids : [ ObjectId("10"),
                   ObjectId("11"),
                   ObjectId("12")]}

Then, to return all categories for a product:

db.categories.find({product_ids : ObjectId("10")})

Or all products for a given category:

db.products.find({category_ids : ObjectId("20")})

Here is an excellent post which describes more or less the same considerations, but in greater clarity and detail.

Actually, it might appear that the problem I am interested in might already have been solved, or close to.  Apparently there is a project called MongoEngine which, according to its webpage, should soon have django support (and already supports flask).  I found that page via this excellent article on how to build an elementary django application, sans admin, using said technology plus a few others.  Unfortunately MongoDB is not the same as the Google Datastore though, which is problematic for myself, although Cloud Foundry might be something to look into in said regard.  Except Cloud Foundry doesn’t support django (although micro cloud foundry, its open-sourced version, apparently does).

So it would seem for now that django-nonrel is the project of choice for use on google app engine.  One-to-many seems supported (through ListField), but not ManyToMany.  The latter would necessitate somehow allowing for db.ReferenceProperty calls via django.models.fields.related.ManyToMany ; ie rewriting that part of the package.   Or, by writing another piece of code, in DjangoToolbox, djangotoolbox.fields.ListPairField, where now the pairs kept track of are pairs of keys, following a remark in this piece on the matter of many-to-many on the google datastore.

Advertisements

Tags: , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: