If you need to do an aggregation in MongoDb on a DateTime property and you want to aggregate only by Date part, you can use a simple trick and use a filter to compose the date part before the grouping. Here is the code   Thanks to the power of aggregation framework, we can construct […]

Continue reading about Aggregate in Mongo using only Date Part of a DateTime property

Searching for a case insensitive match in mongo is really simple, because it has full support for regular expression. As an example if you want to find all properties that is equal to a certain text with case insensitive search you can issue this query db.xxxx.find( { myProperty: /^text$/i } ); This query uses a […]

Continue reading about Insenstive search with Mongo with C# and LINQ provider

I’ve blogged about using MongoDb to store log4net logs, but the original appender has a little problem, it stores a BsonDocument inside the MongoCollection, and does not use any C# object and when it is time to query data you cannot use the new LINQ Mongo provider that is included in newest C# drivers (1.4), […]

Continue reading about Query untyped object inside a Mongo Db (log4net mongoappender)

One of the coolest feature of Mongo is the concept of Capped Collection, or “fixed size” collection. They are based on a FIFO queue where the first record to be discharded is the first inserted, and this is exceptional to create a log-collection that automatically purge all old logs without any user intervention. To be […]

Continue reading about Use Capped collection on MongoAppender for Log4Net

I’ve blogged some days ago on the possibility to save log4net logs inside a Mongo database, but you should be aware that this technique can be dangerous if your objects have circular references. A circular reference happens when object A reference object B and object B directly or indirectly reference object A again and this […]

Continue reading about Logging object with circular reference with Mongo Appender chrashes your process