goodybag/mongo-sql — pull request #81 by jrf0110 (2014-02-08 22:59:47+00:00)
Title: Casts + JSON derefs are malformed during the automated quoting

If you do `{'data->>name::integer': 'Bob'}` you wind up with `"users"."data"->>'name::integer'`.

Here's the code I'm using to correct it now:

```javascript
// Cast? Pre-quote so mongo-sql wont handle (it behaves incorrectly when json derefs are used)
// (by default, you'll get "gui_jsons"."doc"->>'foo::integer' when you need "gui_jsons"."doc"->>'foo'::integer)
if (column2.indexOf('::') !== -1) {
column2 = '("gui_jsons".'+column2.replace(/(->>?)([^:->]*)(::)/, function(v, a, b, c) { return a+'\''+b+'\')'+c; });
}
```

So it can be solved with `{'("gui_jsons".data->>\'name\')::integer': 'Bob'}`, but I don't want to accept quotes in user input so I'm changing it manually.

Is this correctable within mosql?