Advanced MongoDB and the Lithium Framework
So I've been neglecting my blog. I've just been extremely swamped. I want to redesign my entire personal site and blog here. I'm going to rebrand a little bit. I have to get some new business cards for SXSW and more... Anyway, before I do all that I figured I'd post something useful for everyone first.
I've been using a model class, though it could be more of a utility sitting in the "extensions" directory, that helps you work with MongoDB in more advanced ways. This includes some command line calls like mongoimport. Expect to see some more updates to this file as I have the import, but not export. So I'll have that added soon along with some other goodies.
So what can you do with this class? Well, let's start with the import command. You can now easily bundle a JSON file in your project's repo and have a command to set all that initial dependency data. I've also used it to import from a file that I had some other code build first because there were a lot of inserts and the import was faster. You could also say....use it along with a command class method to import from the Twitter streaming API. Pretty exciting right? If you saw the MongoSV keynote then you saw how the JSON feed that Twitter's API provides could very easily be used in the command line with mongoimport. Well, this method here makes it very easy for your application to do the same.
I didn't set up a repository for this one, it's just a single file, for now. You can grab the code here. Be sure to watch the namespace up top and adjust for your application if needed.