https://github.com/master/mongosql
MongoDB SQL wrapper
https://github.com/master/mongosql
Last synced: 12 months ago
JSON representation
MongoDB SQL wrapper
- Host: GitHub
- URL: https://github.com/master/mongosql
- Owner: master
- License: mit
- Created: 2011-03-06T17:12:14.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2013-04-08T13:56:46.000Z (about 13 years ago)
- Last Synced: 2023-03-11T09:27:36.320Z (over 3 years ago)
- Language: Erlang
- Homepage:
- Size: 860 KB
- Stars: 20
- Watchers: 3
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
README
======
This is the SQL wrapper for [MongoDB](http://www.mongodb.org) for Erlang. It mimics interface and behavior of MySQL Native Erlang driver.
[](https://bitdeli.com/free "Bitdeli Badge")
INSTALL
=======
Download and compile MongoSQL and eMongo driver
$ git clone git://github.com/master/emongo.git emongo
$ git clone git://github.com/master/mongosql.git mongosql
$ cd emongo
$ make
$ cd ../mongosql
$ make
$ cd ..
USAGE
=====
$ erl -pa emongo/ebin mongosql/ebin
> application:start(emongo).
> {ok, Pool} = mongosql_conn:start([{"127.0.0.1", 27017}], "test1").
> mongosql_conn:fetch(Pool, "insert into tbl1 col1, col2 values ('string', 1);", false).
{updated,1}
> mongosql_conn:fetch(Pool, "select count(*) from tbl1;", false).
{selected,["count(*)"],[{"1"}]}
> mongosql_conn:fetch(Pool, "select * from tbl1;", false).
{selected,["col1","col2"],[["string",1]]}
> mongosql_conn:fetch(Pool, "delete from tbl1 where col2 = 1;", false).
{updated,1}
> mongosql_conn:fetch(Pool, "select count(*) from tbl1;", false).
{selected,["count(*)"],[{"0"}]}
> mongosql_conn:stop(Pool).