Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL in Mongo Discussion #1

Open
jrf0110 opened this issue Jun 5, 2013 · 0 comments
Open

SQL in Mongo Discussion #1

jrf0110 opened this issue Jun 5, 2013 · 0 comments

Comments

@jrf0110
Copy link

jrf0110 commented Jun 5, 2013

I'm sure a number of people have treaded the waters of making a mongo-like API for interacting with SQL, myself included. Basic API replication is really easy of course, but then you realize that there's a huge void of SQL features simply missing (Joins, sub-queries, aliased queries, etc.). Once you start implementing those, your API starts diverging greatly from mongo.

I think my implementation of MongoSQL could help out a lot. I've got a ton of features implemented and it's incredibly extensible. I don't really have the Docs fleshed out yet, but you can skim the readme, tests, and helpers to get an idea of the capabilities.

Originally, MongoSQL's goal was to mimic Mongo as much as possible. But it's evolved to just writing arbitrary SQL using JSON. One thing to note is MongoSQL's querying capability is very robust. You can arbitrarily embed conditions in the style of mongo:

var $query = {
  type: 'select'
, table: 'users'
, where: {
    createdAt: {
      $or: {
        $gt: '2013-01-01'
      , $lt: '2012-01-01'
      }
    }
  , id: {
      // Id not in
      $nin: {
        type: 'select'
      , table: 'deletedUsers'
      , columns: ['id']
      }
    }
  }
};

Just a thought :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant