In the code below I am trying to call the function getCollection of the object DbModels from within a call to the getCollection function:
DbModels.prototype.addUser = function(Users, callback) {
this.getCollection("seq", function(error, seq_collection) {
if( error ) callback(error)
else {
var ID = seq_collection.find({_id: 'Users'}, {'seq': 1});
console.log("ID is: "+ID);
console.log(this.parent);
this.getCollection("Users", function(error, sel_collection) {....
However, this is not working, because this is referring to the first getCollection. How can I call the getCollection function from within the call to the get Collection?
I already tries this.parent, but that doesn’t do the trick.
Thanks!
store this to a variable beforehand: