Fix Mongo Parition Keys for Connection String mode (#692)

This commit is contained in:
Steve Faulkner 2021-04-18 23:21:10 -05:00 committed by GitHub
parent a53c203286
commit 7265708c15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,5 +1,6 @@
import * as ko from "knockout"; import * as ko from "knockout";
import * as _ from "underscore"; import * as _ from "underscore";
import { AuthType } from "../../AuthType";
import * as Constants from "../../Common/Constants"; import * as Constants from "../../Common/Constants";
import { readCollections } from "../../Common/dataAccess/readCollections"; import { readCollections } from "../../Common/dataAccess/readCollections";
import { readDatabaseOffer } from "../../Common/dataAccess/readDatabaseOffer"; import { readDatabaseOffer } from "../../Common/dataAccess/readDatabaseOffer";
@ -173,7 +174,7 @@ export default class Database implements ViewModels.Database {
const collections: DataModels.Collection[] = await readCollections(this.id()); const collections: DataModels.Collection[] = await readCollections(this.id());
// TODO Remove // TODO Remove
// This is a hack to make Mongo collections read via ARM have a SQL-ish partitionKey property // This is a hack to make Mongo collections read via ARM have a SQL-ish partitionKey property
if (userContext.apiType === "Mongo") { if (userContext.apiType === "Mongo" && userContext.authType === AuthType.AAD) {
collections.map((collection) => { collections.map((collection) => {
if (collection.shardKey) { if (collection.shardKey) {
const shardKey = Object.keys(collection.shardKey)[0]; const shardKey = Object.keys(collection.shardKey)[0];