Hello!

I'm creating MongoDBBrowser that have all CRUD operations and I need a
parser that translates javascript queries in MongoDB to the queries, for
making selects, inserts etc. using Mongo class.
For example, I have query 

db.SomeCollection.find( {$or: [ { name: { $regex: /test/i } }, {
description: { $regex: /test/i } } ] } )

that is manually rewriting into 
someCollection select: { 
        '$or' -> { 
                { 'name' -> { 
                        '$regex' -> 'test' . 
                        '$options' -> 'i' } asDictionary } asDictionary.
                { 'description' -> { 
                        '$regex' -> 'test' . 
                        '$options' -> 'i' } asDictionary } asDictionary
        } 
} asDictionary

But I need to have a parser that will do it automatically.

Maybe there are already exist one? If not, how to write my own?
Please help.

Thanks a lot, Khrystyna=)



--
View this message in context: 
http://forum.world.st/Parser-for-mongodb-queries-in-javascript-notations-tp4942280.html
Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.

Reply via email to