-
Notifications
You must be signed in to change notification settings - Fork 1.8k
refactor!(NODE-3427): remove md5 hashing from GridFS API #2899
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
Changes from 1 commit
7c6527e
c75856c
55a35d5
0b6e8e0
8ce03d4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ import { MongoClient } from './mongo_client'; | |
| import { Db } from './db'; | ||
| import { Collection } from './collection'; | ||
| import { Logger } from './logger'; | ||
| import { GridFSBucket } from './gridfs-stream'; | ||
| import { GridFSBucket } from './gridfs'; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I can revert this, I figured now that its our only "gridfs" no need to name it after its implementation detail |
||
| import { CancellationToken } from './mongo_types'; | ||
|
|
||
| export { | ||
|
|
@@ -195,17 +195,13 @@ export type { | |
| GridFSBucketReadStreamOptionsWithRevision, | ||
| GridFSBucketReadStreamPrivate, | ||
| GridFSFile | ||
| } from './gridfs-stream/download'; | ||
| export type { | ||
| GridFSBucketOptions, | ||
| GridFSBucketPrivate, | ||
| GridFSBucketEvents | ||
| } from './gridfs-stream/index'; | ||
| } from './gridfs/download'; | ||
| export type { GridFSBucketOptions, GridFSBucketPrivate, GridFSBucketEvents } from './gridfs/index'; | ||
| export type { | ||
| GridFSBucketWriteStreamOptions, | ||
| GridFSBucketWriteStream, | ||
| GridFSChunk | ||
| } from './gridfs-stream/upload'; | ||
| } from './gridfs/upload'; | ||
| export type { LoggerOptions, LoggerFunction } from './logger'; | ||
| export type { | ||
| MongoClientEvents, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -66,9 +66,7 @@ describe('GridFS Stream', function () { | |
| expect(error).to.not.exist; | ||
| expect(docs.length).to.equal(1); | ||
|
|
||
| const hash = crypto.createHash('md5'); | ||
| hash.update(license); | ||
| expect(docs[0].md5).to.equal(hash.digest('hex')); | ||
| expect(docs[0]).to.not.have.property('md5'); | ||
|
|
||
| // make sure we created indexes | ||
| filesColl.listIndexes().toArray(function (error, indexes) { | ||
|
|
@@ -179,9 +177,7 @@ describe('GridFS Stream', function () { | |
| expect(error).to.not.exist; | ||
| expect(docs.length).to.equal(1); | ||
|
|
||
| const hash = crypto.createHash('md5'); | ||
| hash.update(license); | ||
| expect(docs[0].md5).to.equal(hash.digest('hex')); | ||
| expect(docs[0]).to.not.have.property('md5'); | ||
|
|
||
| // make sure we created indexes | ||
| filesColl.listIndexes().toArray(function (error, indexes) { | ||
|
|
@@ -257,9 +253,7 @@ describe('GridFS Stream', function () { | |
| expect(error).to.not.exist; | ||
| expect(docs.length).to.equal(1); | ||
|
|
||
| const hash = crypto.createHash('md5'); | ||
| hash.update(license); | ||
| expect(docs[0].md5).to.equal(hash.digest('hex')); | ||
| expect(docs[0]).to.not.have.property('md5'); | ||
| client.close(done); | ||
| }); | ||
| }); | ||
|
|
@@ -1232,7 +1226,9 @@ describe('GridFS Stream', function () { | |
| }); | ||
|
|
||
| function testResultDoc(specDoc, resDoc, result) { | ||
| const specKeys = Object.keys(specDoc).sort(); | ||
| const specKeys = Object.keys(specDoc) | ||
| .filter(key => key !== 'md5') | ||
| .sort(); | ||
|
Comment on lines
+1067
to
+1069
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's new spec tests that omit the md5 property for us, we should use those, but we are also behind on our GridFS sync so I defer that to later work. |
||
| const resKeys = Object.keys(resDoc).sort(); | ||
|
|
||
| expect(specKeys.length === resKeys.length); | ||
dariakp marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We just don't do this anywhere else, so consistency