-
Type:
Improvement
-
Resolution: Done
-
Priority:
Minor - P4
-
None
-
Affects Version/s: 1.6
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
MongoCollection.InsertBatch inserts any number of documents into a collection; however, if the provided IEnumerable is empty, this causes an Assertion to be thrown on the server side, "Message contains no documents". While this has no side-effects that I know of, I suggest a minor improvement: the driver should not dispatch a message to the server at all if the provided IEnumerable is empty.
While it may be a rare and/or obscure scenario, it helps to remove probably unnecessary IO between driver and server and keeps the logs clean. I notice this "issue" happens occassionally in one of my ETL-based applications. While I can address this in my application's code, I think it would also be a nice little improvement on the driver's part to perform a check on its own.