Skip to content

update to latest mongodb driver #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Grid.prototype.findOne = function (options, callback) {
collection.find(find, function(err, cursor) {
if (err) { return callback(err); }
if (!cursor) { return callback(new Error('Collection not found')); }
cursor.nextObject(callback);
cursor.next(callback);
});
}

Expand Down
280 changes: 280 additions & 0 deletions package-lock.json

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

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{
"author": "Aaron Heckmann <aaron.heckmann+github@gmail.com>",
"name": "gridfs-stream",
"author": "Lally Elias <lallyelias87@gmail.com>",
"name": "@lykmapipo/gridfs-stream",
"description": "Writable/Readable Nodejs compatible GridFS streams",
"version": "1.1.1",
"version": "1.2.0",
"license": "MIT",
"keywords": [
"mongodb",
"mongoose",
Expand All @@ -16,7 +17,7 @@
},
"devDependencies": {
"mocha": "*",
"mongodb": "2.0.15",
"mongodb": "3.1.1",
"checksum": "~0.1.1"
},
"optionalDependencies": {},
Expand All @@ -25,6 +26,6 @@
},
"repository": {
"type": "git",
"url": "git://github.com/aheckmann/gridfs-stream.git"
"url": "git://github.com/lykmapipo/gridfs-stream.git"
}
}
15 changes: 10 additions & 5 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var assert = require('assert')
, Stream = require('stream')
, fs = require('fs')
, mongo = require('mongodb')
, MongoClient = mongo.MongoClient
, Grid = require('../')
, crypto = require('crypto')
, checksum = require('checksum')
Expand All @@ -13,23 +14,27 @@ var assert = require('assert')
, txtReadPath =fixturesDir + 'text.txt'
, emptyReadPath = fixturesDir + 'emptydoc.txt'
, largeBlobPath = tmpDir + '1mbBlob'
, server
, url = 'mongodb://localhost:27017'
, dbName = 'gridstream_test'
, client
, db


describe('test', function(){
var id;
before(function (done) {
server = new mongo.Server('localhost', 27017);
db = new mongo.Db('gridstream_test', server, {w:1});
if (!fs.existsSync(tmpDir)) {
fs.mkdirSync(tmpDir);
}
fs.writeFile(largeBlobPath, crypto.randomBytes(1024*1024), function (err) {
if (err) {
done(err);
}
db.open(done)
MongoClient.connect(url, { useNewUrlParser: true }, function(err, _client) {
client = _client;
db = _client.db(dbName);
done(err);
});
});
});

Expand Down Expand Up @@ -784,7 +789,7 @@ describe('test', function(){
}
fs.rmdir(tmpDir, function () {
db.dropDatabase(function () {
db.close(true, done);
client.close(true, done);
});
});
});
Expand Down