decafjs / decaf-mongodb

MongoDB module for decaf
MIT License
0 stars 1 forks source link

Pull request #4

Open mm765 opened 8 years ago

mm765 commented 8 years ago

This wpuldprobably normally be a pull request, but since i don't know how to do that yet, i'll just post it here. I changed decaf-mongodb so that it can connect to databases on other servers and on different ports (which is the part that i needed). This is the changed start of MongoDB.js: /// start of code /**

/* @module MongoDB /

/global require, exports / "use strict";

var MongoClient = Packages.com.mongodb.MongoClient, Collection = require('Collection').Collection;

/*

/// end of code Basically i moved the client = new MongoClient into the constructor, added the parameters and made sure it will still work, if only the first parameter (dbname) is passed, so it shouldn't break existing code (which i tested).

Regards, Matthias

mschwartz commented 8 years ago

I would love to have you submit pull requests.

https://yangsu.github.io/pull-request-tutorial/

You basically fork the repository, make your edits, commit to your fork, then issue the pull request. I'll see the diffs and can just apply them to the master repo.

It's a lot easier than me trying to figure out how to merge your edits by hand. ;)

On Tue, Jan 19, 2016 at 2:31 PM, mm765 notifications@github.com wrote:

This wpuldprobably normally be a pull request, but since i don't know how to do that yet, i'll just post it here. I changed decaf-mongodb so that it can connect to databases on other servers and on different ports (which is the part that i needed). This is the changed start of MongoDB.js: /// start of code /**

  • Created with JetBrains WebStorm.
  • User: mschwartz
  • Date: 6/22/13
  • Time: 11:05 PM */

/* @module https://github.com/module MongoDB /

/global require, exports / "use strict";

var MongoClient = Packages.com.mongodb.MongoClient, Collection = require('Collection').Collection;

/*

  • @param https://github.com/param db
  • @constructor https://github.com/constructor */ function MongoDB(dbname, server, port) { if(server === undefined) { server = "127.0.0.1"; } if(port === undefined) { port = 27017; } var client = new MongoClient(server, port); this.db = client.getDB(dbname); this.requestStarted = false; }

/// end of code Basically i moved the client = new MongoClient into the constructor, added the parameters and made sure it will still work, if only the first parameter (dbname) is passed, so it shouldn't break existing code (which i tested).

Regards, Matthias

— Reply to this email directly or view it on GitHub https://github.com/decafjs/decaf-mongodb/issues/4.

mm765 commented 8 years ago

Yeah, i know - i will give it a try with the help of that tutorial you posted - i will not be able to do it before next week, though.

mschwartz commented 8 years ago

Whenever...

It doesn't take that long. Once you figure it out, I'm happy to look at as many PRs as you send my way.

The idea is to make this work better.

On Tue, Jan 19, 2016 at 3:36 PM, mm765 notifications@github.com wrote:

Yeah, i know - i will give it a try with the help of that tutorial you posted - i will not be able to do it before next week, though.

— Reply to this email directly or view it on GitHub https://github.com/decafjs/decaf-mongodb/issues/4#issuecomment-173023726 .