Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@

All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).

### [1.1.1] - 2021-03-15

#### Added
* Example for mongodb native driver v3.6
* pass option { useUnifiedTopology: true } to the MongoClient constructor

#### Modified
* Updated lodash version
* Updated mongodb version


### [1.1.1] - 2018-05-20

#### Added
Expand Down Expand Up @@ -111,4 +122,4 @@ All notable changes to this project will be documented in this file. This projec
[0.2.1]: https://github.com/dycodedev/mongo-datatable/compare/0.2.0...0.2.1
[0.2.0]: https://github.com/dycodedev/mongo-datatable/compare/0.1.2...0.2.0
[0.1.2]: https://github.com/dycodedev/mongo-datatable/compare/0.1.1...0.1.2
[0.1.1]: https://github.com/dycodedev/mongo-datatable/compare/0.1.0...0.1.1
[0.1.1]: https://github.com/dycodedev/mongo-datatable/compare/0.1.0...0.1.1
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,14 @@ router.get('/data.json', function(req, res, next) {
/* uncomment the line below to enable case insensitive search */
// options.caseInsensitiveSearch = true;

MongoClient.connect('mongodb://localhost/database', function(err, db) {
/**
* MongoDB server Server Discovery and Monitoring engine is deprecated
* To use the new Server Discover and Monitoring engine, pass option { useUnifiedTopology: true } to the MongoClient constructor.
* You still
*/
let opt_connect = { useUnifiedTopology: true }

MongoClient.connect('mongodb://localhost/database', opt_connect, function(err, db) {
new MongoDataTable(db).get('collection', options, function(err, result) {
if (err) {
// handle the error
Expand Down Expand Up @@ -128,8 +135,7 @@ router.get('/data.json', function(req, res, next) {
* It yields the instance of MongoClient instead.
* To get Db instance, you can call `db` method of client with the database name as the argument
*/

MongoClient.connect('mongodb://localhost/database', function(err, client) {

var db = client.db('database');
new MongoDataTable(db).get('collection', options, function(err, result) {
if (err) {
Expand Down Expand Up @@ -181,4 +187,4 @@ router.get('/data.json', function(req, res, next) {
});
});
...
```
```
30 changes: 25 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mongo-datatable",
"version": "1.1.1",
"version": "1.1.2",
"description": "NodeJS module for server-side processing using jquery datatables and mongodb native driver.",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion test/config/dycode.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ module.exports = {
return 'mongodb://' + this.host + ':' + this.port + '/' + this.dbname;
}
}
}
}
4 changes: 2 additions & 2 deletions test/config/local.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
username: '',
password: '',
get connectionUri() {
return 'mongodb://' + this.host + ':' + this.port + '/' + this.dbname;
return `mongodb://${this.username}:${this.password}@${this.host}:${this.port}`;
}
}
}
}
Loading