I've got an application that runs on NodeJS, and uses MongoDB as a database for information.
Currently I hook into MongoDB via the MongoJS module, which aims to "emulate the official mongodb API as much as possible".
The application gets about 20,000 objects and saves each one to MongoDB. First, it looks up the database to see whether the object already exists, then it either updates the existing entry or adds a new entry.
This can be quite slow. I'm not sure if it's because MongoJS
is synchronous/single-stream (if it even is - I'm not sure!), or it's just a reality of writing a lot of entries to a DB, but it takes 45min-1hr to do all of this and I'd obviously like to cut this down as much as possible.
I'm wondering whether Mongoose would be a better/faster option for this. Apparently it's asynchronous, I don't know whether that would have an affect at all on performance.