Inserts Take Less Than a Millisecond}
Testing the code in the browser the very first time was a bit slow (about 1,000 milliseconds), because the collection had to first be created. But upon refreshing the browser window I saw that the collection w
;
collection.findOne(search, function(err, doc) {
In this case, one field is a string and the other is a regular expression. Without an index, it took more than 4,000 milliseconds (4 seconds) to find. I used the mongo//DESK: leave lowercase// shell to add an index. Subsequently, the query time dropped to around 0.6 milliseconds. This, of course, is a feature of MongoDB itself, but it showed how quickly a retrieval can run using the Node.js driver, as long as the database is configured properly.
In addition to the usual database operations such as inserting and querying, the MongoDB driver also includes administration functionality, which I could have used to write system administration utilities. This functionality includes adding, removing and authenticating users; enumerating the databases and collections; setting profiling levels; and so on.
Finally, one item thats notably missing from the driver is high-level object modeling. This is by design, as its meant to be a low-level driver that only covers direct MongoDB features. If youre looking for modeling, I recommend using this driver in conjunction with the Mongoose library.








