Skip to content

Commit 2c71d75

Browse files
rueckstiesskangas
authored andcommitted
INT-1826 use native schema parser (#475)
* adjusted to use new schema interface. * bump [email protected]. (cherry picked from commit e6a0328)
1 parent f9dee4f commit 2c71d75

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
"mongodb-js-metrics": "^1.5.0",
132132
"mongodb-language-model": "^0.3.3",
133133
"mongodb-ns": "^1.0.3",
134-
"mongodb-schema": "^4.2.4",
134+
"mongodb-schema": "^5.0.0",
135135
"ms": "^0.7.1",
136136
"ncp": "^2.0.0",
137137
"numeral": "^1.5.3",

src/internal-packages/schema/lib/store/index.jsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const app = require('ampersand-app');
22
const Reflux = require('reflux');
33
const StateMixin = require('reflux-state-mixin');
4-
const Schema = require('mongodb-schema').Schema;
4+
const schemaStream = require('mongodb-schema').stream;
55
const _ = require('lodash');
66

77
// stores
@@ -124,8 +124,8 @@ const SchemaStore = Reflux.createStore({
124124
}, 1000);
125125

126126
this.samplingStream = app.dataService.sample(ns, options);
127-
const schema = new Schema();
128-
this.analyzingStream = schema.stream(true);
127+
this.analyzingStream = schemaStream();
128+
let schema;
129129

130130
const onError = () => {
131131
this.setState({
@@ -178,12 +178,15 @@ const SchemaStore = Reflux.createStore({
178178
});
179179
}
180180
})
181+
.on('data', (data) => {
182+
schema = data;
183+
})
181184
.on('error', (analysisErr) => {
182185
onError(analysisErr);
183186
})
184187
.on('end', () => {
185188
if ((numSamples === 0 || sampleCount > 0) && this.state.samplingState !== 'error') {
186-
onSuccess(schema.serialize());
189+
onSuccess(schema);
187190
} else {
188191
return onError();
189192
}

0 commit comments

Comments
 (0)