I use offical C# Driver for mongodb, I want to use SetFields from a FindOne query like Find.
var query = Query.EQ("Name", name);
Users.Find(query).SetFields(Fields.Exclude("Password"));
Is it possible to do that as FindOne return a actual class instead of mongodb cursor.
SetFieldsmethod of MongoCursor.Method FindOne just wrapper around MongoCursor and internally it looks so:
If you want add Exclude Fields functionality to it you can simply add extention method for
MongoCollection:And use it like this: