TMongoWireMongoDB 的 Delphi 驱动
TMongoWire 是一个 Delphi 的驱动,用来访问 MongoDB 数据库,它将映射 Delphi 的数据类型 OleVariant。
示例代码:
TBSONDocument = class(TInterfacedObject, IBSONDocument, IPersistStream) Holds the data of a 'document', the basic unit of data mongoDB works with. Implements an IBSONDocument interface which allows it to be referenced by an OleVariant variable, which enables embedding documents. Implements the IPersistStream interface to enable loading from and saving to BSON, the internal binary storage specification used by mongoDB. function BSON: IBSONDocument; overload; function BSON(x: array of OleVariant): IBSONDocument; overload; Creates a BSON document object ready for use. Optionally pass a sequence of key-value pairs, e.g.: BSON(['x',5,'y',7]); Use '[' and ']' to created embedded documents, e.g.: BSON(['x','[','$gt',7,']']); Use VarArrayOf or 1-dimensional variant arrays to add arrays, e.g.: BSON(['x',VarArrayOf([1,2,3])]);
评论