pebongo 介绍
pebongo 是 MongoDB 数据库的 Delphi 驱动接口。
示例代码:
//example #2 on bsonspec.org var bson : TBSONDocument; item : TBSONArrayItem; begin bson := TBSONDocument.Create; item := TBSONArrayItem.Create; item.Items[0] := TBSONStringItem.Create( 'awesome' ); item.Items[1] := TBSONDoubleItem.Create( 5.05 ); item.Items[2] := TBSONIntItem.Create( 1986 ); bson.Values['BSON'] := item; bson.SavetoFile( ExtractFilePath( Application.ExeName ) + 'hello.bson' ); bson.Free; //preliminary driver interface var mongo : TMongoConnection; coll : TMongoCollection; cursor : TMongoCursor; i : integer; begin mongo := TMongoConnection.Create; memo1.lines.add( booltostr( mongo.Connected, true ) ); mongo.GetDatabase( 'tesdb' ); coll := mongo.GetCollection( 'things' ); cursor := coll.find( ); memo1.lines.add( inttostr( cursor.Count ) ); for i := 0 to cursor.Count - 1 do memo1.lines.add( cursor.Result[i].ToString );//print as JSON cursor.Free; coll.Free; mongo.Free; end;
pebongo 官网
https://github.com/pebbie/pebongo
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。