[CSHARP-919] Add Setter to MongoCursor.Query property Created: 28/Feb/14  Updated: 02/Feb/18  Resolved: 02/Feb/18

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: 1.11
Fix Version/s: None

Type: Improvement Priority: Trivial - P5
Reporter: Gareth Budden Assignee: Robert Stam
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

I would like to be able to amend a query before the cursor has been frozen. It's possible to do this for Flags, Fields, Options, and other properties, I know it's trivial but would help me out.



 Comments   
Comment by Robert Stam [ 02/Feb/18 ]

This ticket applies to the 1.x versions of the driver which are no longer being enhanced.

Comment by Robert Stam [ 19/Mar/14 ]

One concern we have about adding a SetQuery method to MongoCursor<T> is that while it seems like a trivial change, and consistent with other SetXyz methods that already exist, is that the query seems central to the nature of the MongoCursor and if you change the query in some sense it is no longer the same MongoCursor.

Consider the following sample code:

var cursor = collection.FindAll();
...
 
cursor.SetQuery(someQuery); // whoa, it no longer returns All documents...

Or another example:

var females = collection.Find(Query.EQ("Gender", "F"));
...
females.SetQuery(Query.EQ("Gender", "M")); // whoa, completely changed the meaning of the cursor

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