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 ...