[CSHARP-1237] The find fluent api should output shell syntax on ToString() Created: 08/Apr/15  Updated: 16/Jul/15  Resolved: 01/May/15

Status: Closed
Project: C# Driver
Component/s: API
Affects Version/s: 2.0
Fix Version/s: 2.0.1, 2.1

Type: Improvement Priority: Trivial - P5
Reporter: Craig Wilson Assignee: Craig Wilson
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

When calling ToString() on the aggregate fluent api outputs a shell compatible syntax of the current pipeline. The same thing should be done for find.



 Comments   
Comment by Roberto Pérez [ 02/May/15 ]

Thanks for your quick response.

I was thinking in something similar like "Database.Log" in EntityFramework, where, you can redirected all translated queries, updates, deletes and inserts to, for example, the Console.

Anyway, I really appreciate what you have just done

Thanks!

Comment by Craig Wilson [ 02/May/15 ]

Hi Roberto,

That's not possible. We can do this for Find() and for Aggregate() because they return a type we have control over. However, DeleteOneAsync, for instance, returns a Task<DeleteOneResult>. We can't add a ToString() implementation to it.

Craig

Comment by Roberto Pérez [ 02/May/15 ]

Thank you very much for your implementation.

However, I think that it would be desirable to have this .ToString() implementation for every method of the IMongoCollection<TDocument> interface. (DeleteOneAsync, FindOneAndReplaceAsync, UpdateManyAsync...)

Regards

Comment by Githook User [ 01/May/15 ]

Author:

{u'username': u'craiggwilson', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}

Message: CSHARP-1237: added ToString on FindFluent.
Branch: v2.0.x
https://github.com/mongodb/mongo-csharp-driver/commit/94fc89f8130ba4c4e337231752d18540b121b095

Comment by Githook User [ 01/May/15 ]

Author:

{u'username': u'craiggwilson', u'name': u'Craig Wilson', u'email': u'craiggwilson@gmail.com'}

Message: CSHARP-1237: added ToString on FindFluent.
Branch: master
https://github.com/mongodb/mongo-csharp-driver/commit/5bce427ca733dc3d5a812bffb873aaad3eb6ec55

Generated at Wed Feb 07 21:39:02 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.