Skip to content
This repository was archived by the owner on Dec 24, 2018. It is now read-only.
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
4 changes: 2 additions & 2 deletions bin/mongobq
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ program
.option('-p, --password <password>', 'specifies a mongodb password to authenticate')
.option('-d, --database <database>', 'specifies the name of the database')
.option('-c, --collection <collection>', 'specifies the collection to export')
.option('-f, --fields <field1[,field2]>', 'specifies a field or fields to include in the export')
.option('-f, --fields <JSON>', 'specifies a field or fields to include in the export', JSON.parse)
.option('-q, --query <JSON>', 'provides a JSON document as a query that optionally limits the documents returned in the export', JSON.parse)
.option('-K, --keyfile <keyfile>', 'specifies the key file path')
.option('-B, --bucket <bucket>', 'specifies the Google Cloud Storage bucket name')
Expand All @@ -41,7 +41,7 @@ var opts = {
username: program.username,
password: program.password,
query: program.query || {},
fields: parseFields(program.schema, program.fields),
fields: program.fields,
project: program.project,
keyfile: program.keyfile,
bucket: program.bucket,
Expand Down
2 changes: 1 addition & 1 deletion lib/mongo.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function Mongo(opts) {
this.mongodbUri = buildMongodbUri(opts);
this.collection = opts.collection;
this.query = opts.query || {};
this.fields = buildField(opts.fields);
this.fields = opts.fields;
this.limit = opts.limit;
this.skip = opts.skip;
this.db = null;
Expand Down
2 changes: 1 addition & 1 deletion lib/mongobq.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ MongoBQ.prototype.uploadToGCS = function (next) {
var count = 0;
var autoSchemaDetection = !self.opts.schema;
var schema = self.opts.schema || [];
var fields = self.opts.fields || [];
var fields = self.opts.fields;
var stream = self.mongo.stream(self.opts.batchSize)
.pipe(GCP.BigQueryTable.createJSONStream(schema, autoSchemaDetection))
.on('data', function (d) { count++; })
Expand Down