Just a few bits and bobs I've collected up lately.
Aggregation is a neat feature in MongoDB and as with most mongo c# stuff it's often a small hurdle to implementing the same query you perform in BSON in the driver language…
Sooo just to get you started https://chrismckee.co.uk/mongo-aggregation-in-c/
Quite a good idea to mix this with Profiling so you can watch how it's querying etc...
Pipeline Requests I like the pipe & filters way of dealing with 'tasks' and for long queries it can make for more readable queries; of course someone's written a lib for that.
- Git: https://github.com/melkio/MongoDB.Extensions
- Nuget: Install-Package MongoDB.Extensions
Profiling If you're looking for a MongoDB equivalent of SQL Profiler look no further than MongoTail; pretty new and running on Python it allows you to quickly connect, set profiling level and start to output the queries. You can then of course grep away to reduce the output and pipe where you like.
- Git: https://github.com/mrsarm/mongotail
- Python Package Manager: pip install mongotail
Of course when you're writing your queries in MongoDB C# Driver, especially with linq, it can be a PITA…
- Git: https://github.com/mikeckennedy/mongodb-query-helper-for-dotnet
- Nuget: Install-Package MongoDB.QueryHelper
Handy little library to use or extend on.
MongoChef http://3t.io/mongochef/ seriously the best MongoDB management tool you can get these days after RoboMongo prettymuch abandoned development post v3. Free licence for playing/open source gubbins, pretty fair 'user' rather than machine licence when you pay allowing you to install it on how ever many laptops/pcs you use.
Download MongoDB to your local machine and install the client/tools (skip the server unless you really want to run that locally as well) in order to use the IntelliShell in MongoChef (nice handy interface, like sql query window where you can type queries out with intellisense); it also has a Query Builder which can be handy, an aggregation query builder which is quite nice for building them up and reordering the pipeline before you commit it to code, and the ability to manage users and an often neglected feature in mongo clients AN EXPORT / IMPORT BUTTON.
The only thing that bugs me about MongoChef is the export as json; if you store ID's or .net style GUIDs as your bson id it's encoded; robomongo would spit that out as a guid, mongochef in csv mode spits it out as a guid, in json mode spits it out as the weird bson format. Small irritation to be honest :)