Apply "technologies" to queried document automatically

I am making hobbistic "civlike" game using node.js+mongoose+websocket (it's only back-end - mostly for training), and i stuck on "technologies" - don't know how to implement them.

First idea was "overload" a exec() method and there add something like:

Techs.apply(result);    

,but it can't be done like that - it's asynchronous and exec() has no acces to returned docs.

Without it i have to every time i query for docs apply them manually - but i don't think its best way to do it, maybe im wrong or it's only way to do it?

Because it's asynchronous, you have to deal with the document in your callback function. I think what you are trying to do is this.

Fetch the document by it's ID

    // docId is the _id passed from the client
    Techs.findById(docId, function(err, doc) {

        // This code executes after we've returned from MongoDB with the answer
        // Now you can either updated it some code like this
        doc.title = 'new title';

        // Then after you've updated you need to call the save() function
        doc.save();

        // Now send the response to the client
        response.end(doc); // this will send the JSON of the doc to the client

    });

OR

Search for one document by a field (type:'iphone')

    // Find a document based on a query
    Techs.findOne({type: 'iphone' }, function(err, doc) {

        // This code executes after we've returned from MongoDB with the answer
        // Now you can either updated it some code like this
        doc.title = 'new title';

        // Then after you've updated you need to call the save() function
        doc.save();

        // Now send the response to the client
        response.end(doc); // this will send the JSON of the doc to the client

    });