Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Delphi MongoDB driver
Pascal
Tree: ed67ce2e96

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
demo/example1
COPYING
README
VBScript_RegExp_55_TLB.pas
bsonDoc.pas
bsonUtils.pas
mongoAuth.pas
mongoID.pas
mongoStream.pas
mongoWire.pas
todo.txt

README

Delphi MongoDB Driver
---------------------

A Delphi driver to access a mongoDB server.
It maps variables onto Delphi variables of type OleVariant, which resembles the loose typing of JavaScript.
There are two main units and three main classes to enable access to a mongo DB server:

bsonDoc.pas
  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)]);

mongoWire.pas
  TMongoWire=class(TObject)
    A connection to a mongoDB server. Supports getting single items, performing inserts, updates and deletes.

  TMongoWireQuery=class(TBSONDocumentsEnumerator)
    A query to a mongoDB server, handles the cursor and subsequent requests to the server to get more data when needed.
	
http://yoy.be/TMongoWire
https://github.com/stijnsanders/TMongoWire


Additional tools
----------------

bsonUtils.pas
  function BsonToJson(Doc:IBSONDocument):WideString;
    Converts a BSON document into a JSON string.
  function JsonToBson(jsonData:WideString):IBSONDocument;
    Converts a JSON string into a BSON document.
  procedure JsonIntoBson(jsonData:WideString;doc:IBSONDocument); overload;
    Parses a JSON string and adds any keys to an existing BSON document, overwriting the value if a key already exists.
  procedure JsonIntoBson(jsonData:WideString;doc:IBSONDocument;var EndIndex:integer); overload;
    Parses only the first JSON object from a string into an existing BSON document, and returns the index into the string where the JSON object ends.
	Use this method to iterate over a list of JSON strings. (See also IBSONDocument.Clear)
Something went wrong with that request. Please try again.