摘要:[MongoDB][000][官方api學習紀錄]FieldDefinition
c# driver version:2.1:
程度還不到那,因此只能用自己的方式解釋這個api:
public static implicit operator FieldDefinition<TDocument, TField> ( string fieldName )
官方的說法是:
Performs an implicit conversion from String to FieldDefinition<TDocument, TField>.
我自己的說法是:
將字串 fieldName直接assign給某某物件,此物件的型態為FieldDefinition<TDocument, TField>,此物件就會自動知道
要將這個字串assign給TDocument Class裡面的TField成員
用GridFS取得檔案的GridFSFileInfo的舉例來說:
var filter = Builders<GridFSFileInfo>.Filter.Eq("_id", new ObjectId(objectID));
上面的_id就會Implicit Conversion隱性轉型為FieldDefinition<GridFSFileInfo, ObjectId>物件裡面的某個member,
這個member應該就是GridFSFileInfo Class裡面的ObjectId成員
依我的程度先解釋到這裡...
參考文章:
FieldDefinition<TDocument, TField>Implicit Conversion (String to FieldDefinition<TDocument, TField>)
http://api.mongodb.org/csharp/current/html/M_MongoDB_Driver_FieldDefinition_2_op_Implicit_1.htm
[asp.net]瞭解implicit operator隱性轉型
http://www.dotblogs.com.tw/kevinya/archive/2015/11/04/153792.aspx
Mongodb:Fail to get GridFSFileInfo by ObjectID, but succeed by filename