SQL to MongoDB javascript bridge