Showing posts from September, 2013

Query logging and profiling in MongoDB

In my previous blog post I mentioned that the 1.5.0 release of the MongoDB driver for PHP has improved notification support using the PHP Notification API, and showed off a fairly useless (but fun) progress bar.
Now its time for a little bit more practical examples using this system: Query logging and profiling.

Those of you who clicked through to the github Pull Request may have noticed the long long description of the API and noticed all the different "MONGO_STREAM_NOTIFY_LOG_xxx" constants it included..

When instantiating MongoClient you can pass in "Driver Options" using the 3rd argument. Currently there is only one available Driver Option: "context".

The context key takes a Stream Context, and is assigned to all of the underlaying connections the driver creates - which means you can set any of the Socket Context and SSL Context options and it will Just Work (maaan.. that saved me a ton of work.. Not needing to implement any of the SSL things myself!)…

PHP Stream Notifications ❤ MongoDB

PHP Streams have several pretty nifty features that most people don't really know about; Filters, Wrappers, Context, and Notifications. Documenting these is a bit difficult, and getting the user to discover these features is even more problematic, as these things usually live outside of the normal path (function reference).
Maybe I'll blog about these things in the future, but for now I want to talk about the Stream (context) Notifications - or more specifically; Stream Notifications in the MongoDB extension for PHP.

The Stream Notifications are essentially pretty simple: when a stream does something, it notifies something (a callback function) that it did something (notification codes, importance, message code, ..).
Since this feature is a little neglected and people don't seem to know about it, this "something happened" isn't really a lot of things. When PHP reads from the http stream it will tell you if it came across a "redirect header", "m…

New designs floating around

Since 2008 there have been numerous efforts to create a new design for, all of which have failed - so far.
We've never come as close as two years ago, when the "beta mode" option was added to our website, but we never really got around to finish it.
The "beta design" has even received a lot of makeover compared to what is "beta mode" now.
To make things a little bit more awesome, there is also a new branch called "responsive" which has a lot of changes in it too, especially for manual pages.

Hopefully, one day, we'll actually finish one of these and flip the switch forever.

In the meanwhile, I'm working on retiring my little baby, PhD, as I want to encourage more people to get involved with the overall project, especially the neglected parts like documentations.
It doesn't help anyone to be greeted with a "ohh, btw, you have to have a doctorate to be able to work on the docs" like "almost" is the c…

A lot of things happen in two years..

Turns out; The title of the blog is completely true.. I really really don't blog :)
Since my last blog entry, just over 2 years ago, I..
Left my job at Redpill LinproMoved from Oslo to LondonJoined 10gen (now MongoDB)Moved to San FranciscoGot marriedMoved to Menlo Park
..and now I'm expecting a female ninja early next year..

That is a good chunk of life changing events crammed into only ~2 years :)
Thats it for now though.. Mainly just wanted to see if this thing still worked.