Skip to content

Commit b7eae99

Browse files
committed
bsontype
1 parent 74b1135 commit b7eae99

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

packages/compass-data-modeling/src/components/drawer/field-drawer-content.tsx

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
TextInput,
1111
} from '@mongodb-js/compass-components';
1212
import toNS from 'mongodb-ns';
13+
import { BSONType } from 'mongodb';
1314
import {
1415
createNewRelationship,
1516
deleteRelationship,
@@ -55,16 +56,7 @@ type FieldDrawerContentProps = {
5556
) => void;
5657
};
5758

58-
const TYPES = [
59-
'objectId',
60-
'string',
61-
'int',
62-
'bool',
63-
'date',
64-
'object',
65-
'array',
66-
] as const;
67-
// TODO: get the full list from somewhere
59+
const BSON_TYPES = Object.keys(BSONType);
6860

6961
export function getIsFieldNameValid(
7062
currentFieldPath: FieldPath,
@@ -111,7 +103,6 @@ const FieldDrawerContent: React.FunctionComponent<FieldDrawerContentProps> = ({
111103
onRenameField,
112104
onChangeFieldType,
113105
}) => {
114-
console.log({ TYPES, types });
115106
const { value: fieldName, ...nameInputProps } = useChangeOnBlur(
116107
fieldPath[fieldPath.length - 1],
117108
(fieldName) => {
@@ -156,10 +147,11 @@ const FieldDrawerContent: React.FunctionComponent<FieldDrawerContentProps> = ({
156147
aria-label="Datatype"
157148
disabled={true} // TODO: enable when field type change is implemented
158149
value={types}
150+
size="small"
159151
multiselect={true}
160152
clearable={false}
161153
>
162-
{TYPES.map((type) => (
154+
{BSON_TYPES.map((type) => (
163155
<ComboboxOption
164156
key={type}
165157
value={lowerFirst(type)}

packages/compass-data-modeling/src/utils/schema-traversal.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,6 @@ export const getFieldFromSchema = ({
170170
jsonSchema: nextStep,
171171
};
172172
}
173-
console.log('Search lower', {
174-
jsonSchema: nextStep,
175-
fieldPath: remainingFieldPath,
176-
parentFieldPath: [...parentFieldPath, nextInPath],
177-
});
178173
// Continue searching in the next step
179174
return getFieldFromSchema({
180175
jsonSchema: nextStep,

0 commit comments

Comments
 (0)