Giter Club home page Giter Club logo

mongo's Introduction

mongo Build Status

Pure Haxe MongoDB driver that is meant to be truly cross platform.

Background

There are other Haxe drivers out there but they use sys.net.Socket which is not available on all targets. Also they use sync operations which is not suitable in single-thread environments.

This driver utilizes tink_tcp which provides async TCP operations across all targets in a consistent manner. So this driver should work on any targets that is supported by tink_tcp.

Usage

Mongo.connect().handle(function(o) switch(o) {
	case Success(mongo):
		var db = mongo.db('test');
		var collection = db.collection('users');
		collection.find({filter:{username:'foo'}}).handle(function(o) trace(o));
	case Failure(err):
		trace(err);
});

More to come...

Status

This is pretty much work in progress in a sense that although the protocol to communicate with the database server is complete, not all database commands are wrapped in a function call (e.g. db.dropDatabase() or collection.find({})). But you can run most, if not all, commands through db.runCommand(command) by following the official manual.

To illustrate, collection.find({filter:{a:1}}) is equivalent to:

var cmd = new BsonDocument();
cmd.add('find', 'collection_name');
cmd.add('filter', {a:1});
db.runCommand(cmd);

Note

This library is the driver only. So, do expect that the commands and responses will be very "raw", though efforts has been made to properly typing them.

THis library does not include ORM, but they can be built based on this driver.

mongo's People

Contributors

kevinresol avatar

Stargazers

Anders Nissen avatar Rafael Oliveira avatar David Klein avatar Matthijs Kamstra avatar Jonas Nyström avatar Ben avatar

Watchers

James Cloos avatar  avatar David Klein avatar

Forkers

sondro

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.