gett/mongojs — Issue #13: Using "this" keyword to access the current collection
Author: kevinmctigue
Created: 2012-01-24 20:02:03+00:00
State: open

I think it would be a nice feature to .bind() callback functions to the current collection, so that "this" refers to it. It would cut down on repeat code. Here's what it would look like:

```javascript
db.mycollection.find(function(err, docs) {
// "this" refers to db.mycollection since it's a callback inside it
this.update({_id: 123}, {name: "MongoJS"}, function(err, updated) {
// wouldn't this be nifty?
});
});
```

If this is something that gets approved, I'd be glad to try to implement it. What do you guys think?