mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-02-16 09:15:35 +00:00
Minor changes to vcore mongo quickstart based on feedback (#1678)
This commit is contained in:
parent
15e35eaa82
commit
bc68b4dbf9
@ -1,5 +1,6 @@
|
|||||||
export const newDbAndCollectionCommand = `use quickstartDB
|
export const newDbAndCollectionCommand = `use quickstartDB
|
||||||
db.createCollection('sampleCollection')`;
|
db.createCollection('sampleCollection')
|
||||||
|
`;
|
||||||
|
|
||||||
export const newDbAndCollectionCommandForDisplay = `use quickstartDB // Create new database named 'quickstartDB' or switch to it if it already exists
|
export const newDbAndCollectionCommandForDisplay = `use quickstartDB // Create new database named 'quickstartDB' or switch to it if it already exists
|
||||||
|
|
||||||
@ -16,19 +17,25 @@ export const loadDataCommand = `db.sampleCollection.insertMany([
|
|||||||
{title: "War and Peace", author: "Leo Tolstoy", pages: 1392},
|
{title: "War and Peace", author: "Leo Tolstoy", pages: 1392},
|
||||||
{title: "The Odyssey", author: "Homer", pages: 374},
|
{title: "The Odyssey", author: "Homer", pages: 374},
|
||||||
{title: "Ulysses", author: "James Joyce", pages: 730}
|
{title: "Ulysses", author: "James Joyce", pages: 730}
|
||||||
])`;
|
])
|
||||||
|
`;
|
||||||
|
|
||||||
export const queriesCommand = `db.sampleCollection.find({author: "George Orwell"})
|
export const findOrwellCommand = `db.sampleCollection.find({author: "George Orwell"})
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const findOrwellCommandForDisplay = `// Query to find all books written by "George Orwell"
|
||||||
|
db.sampleCollection.find({author: "George Orwell"})`;
|
||||||
|
|
||||||
|
export const findByPagesCommand = `db.sampleCollection.find({pages: {$gt: 500}})
|
||||||
|
`;
|
||||||
|
|
||||||
|
export const findByPagesCommandForDisplay = `// Query to find all books with more than 500 pages
|
||||||
db.sampleCollection.find({pages: {$gt: 500}})
|
db.sampleCollection.find({pages: {$gt: 500}})
|
||||||
|
`;
|
||||||
|
|
||||||
db.sampleCollection.find({}).sort({pages: 1})`;
|
export const findAndSortCommand = `db.sampleCollection.find({}).sort({pages: 1})
|
||||||
|
`;
|
||||||
|
|
||||||
export const queriesCommandForDisplay = `// Query to find all books written by "George Orwell"
|
export const findAndSortCommandForDisplay = `// Query to find all books and sort them by the number of pages in ascending order
|
||||||
db.sampleCollection.find({author: "George Orwell"})
|
db.sampleCollection.find({}).sort({pages: 1})
|
||||||
|
`;
|
||||||
// Query to find all books with more than 500 pages
|
|
||||||
db.sampleCollection.find({pages: {$gt: 500}})
|
|
||||||
|
|
||||||
// Query to find all books and sort them by the number of pages in ascending order
|
|
||||||
db.sampleCollection.find({}).sort({pages: 1})`;
|
|
||||||
|
@ -11,11 +11,15 @@ import {
|
|||||||
} from "@fluentui/react";
|
} from "@fluentui/react";
|
||||||
import { customPivotHeaderRenderer } from "Explorer/Quickstart/Shared/QuickstartRenderUtilities";
|
import { customPivotHeaderRenderer } from "Explorer/Quickstart/Shared/QuickstartRenderUtilities";
|
||||||
import {
|
import {
|
||||||
|
findAndSortCommand,
|
||||||
|
findAndSortCommandForDisplay,
|
||||||
|
findByPagesCommand,
|
||||||
|
findByPagesCommandForDisplay,
|
||||||
|
findOrwellCommand,
|
||||||
|
findOrwellCommandForDisplay,
|
||||||
loadDataCommand,
|
loadDataCommand,
|
||||||
newDbAndCollectionCommand,
|
newDbAndCollectionCommand,
|
||||||
newDbAndCollectionCommandForDisplay,
|
newDbAndCollectionCommandForDisplay,
|
||||||
queriesCommand,
|
|
||||||
queriesCommandForDisplay,
|
|
||||||
} from "Explorer/Quickstart/VCoreMongoQuickstartCommands";
|
} from "Explorer/Quickstart/VCoreMongoQuickstartCommands";
|
||||||
import { useTerminal } from "hooks/useTerminal";
|
import { useTerminal } from "hooks/useTerminal";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
@ -190,17 +194,17 @@ export const VcoreMongoQuickstartGuide: React.FC = (): JSX.Element => {
|
|||||||
</Text>
|
</Text>
|
||||||
<DefaultButton
|
<DefaultButton
|
||||||
style={{ marginTop: 16, width: 110 }}
|
style={{ marginTop: 16, width: 110 }}
|
||||||
onClick={() => useTerminal.getState().sendMessage(queriesCommand)}
|
onClick={() => useTerminal.getState().sendMessage(findOrwellCommand)}
|
||||||
>
|
>
|
||||||
Try query
|
Try query
|
||||||
</DefaultButton>
|
</DefaultButton>
|
||||||
<Stack horizontal style={{ marginTop: 16 }}>
|
<Stack horizontal style={{ marginTop: 16 }}>
|
||||||
<TextField
|
<TextField
|
||||||
id="queriesCommand"
|
id="findOrwellCommand"
|
||||||
multiline
|
multiline
|
||||||
rows={5}
|
rows={2}
|
||||||
readOnly
|
readOnly
|
||||||
defaultValue={queriesCommandForDisplay}
|
defaultValue={findOrwellCommandForDisplay}
|
||||||
styles={{
|
styles={{
|
||||||
root: { width: "90%" },
|
root: { width: "90%" },
|
||||||
field: {
|
field: {
|
||||||
@ -214,7 +218,65 @@ export const VcoreMongoQuickstartGuide: React.FC = (): JSX.Element => {
|
|||||||
iconProps={{
|
iconProps={{
|
||||||
iconName: "Copy",
|
iconName: "Copy",
|
||||||
}}
|
}}
|
||||||
onClick={() => onCopyBtnClicked("#queriesCommand")}
|
onClick={() => onCopyBtnClicked("#findOrwellCommand")}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
<DefaultButton
|
||||||
|
style={{ marginTop: 32, width: 110 }}
|
||||||
|
onClick={() => useTerminal.getState().sendMessage(findByPagesCommand)}
|
||||||
|
>
|
||||||
|
Try query
|
||||||
|
</DefaultButton>
|
||||||
|
<Stack horizontal style={{ marginTop: 16 }}>
|
||||||
|
<TextField
|
||||||
|
id="findByPagesCommand"
|
||||||
|
multiline
|
||||||
|
rows={2}
|
||||||
|
readOnly
|
||||||
|
defaultValue={findByPagesCommandForDisplay}
|
||||||
|
styles={{
|
||||||
|
root: { width: "90%" },
|
||||||
|
field: {
|
||||||
|
backgroundColor: "#EEEEEE",
|
||||||
|
fontFamily:
|
||||||
|
"Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<IconButton
|
||||||
|
iconProps={{
|
||||||
|
iconName: "Copy",
|
||||||
|
}}
|
||||||
|
onClick={() => onCopyBtnClicked("#findByPagesCommand")}
|
||||||
|
/>
|
||||||
|
</Stack>
|
||||||
|
<DefaultButton
|
||||||
|
style={{ marginTop: 32, width: 110 }}
|
||||||
|
onClick={() => useTerminal.getState().sendMessage(findAndSortCommand)}
|
||||||
|
>
|
||||||
|
Try query
|
||||||
|
</DefaultButton>
|
||||||
|
<Stack horizontal style={{ marginTop: 16 }}>
|
||||||
|
<TextField
|
||||||
|
id="findAndSortCommand"
|
||||||
|
multiline
|
||||||
|
rows={2}
|
||||||
|
readOnly
|
||||||
|
defaultValue={findAndSortCommandForDisplay}
|
||||||
|
styles={{
|
||||||
|
root: { width: "90%" },
|
||||||
|
field: {
|
||||||
|
backgroundColor: "#EEEEEE",
|
||||||
|
fontFamily:
|
||||||
|
"Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New",
|
||||||
|
},
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<IconButton
|
||||||
|
iconProps={{
|
||||||
|
iconName: "Copy",
|
||||||
|
}}
|
||||||
|
onClick={() => onCopyBtnClicked("#findAndSortCommand")}
|
||||||
/>
|
/>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack>
|
</Stack>
|
||||||
@ -236,7 +298,7 @@ export const VcoreMongoQuickstartGuide: React.FC = (): JSX.Element => {
|
|||||||
hosted in the cloud, to Azure Cosmos DB for MongoDB vCore.
|
hosted in the cloud, to Azure Cosmos DB for MongoDB vCore.
|
||||||
<Link
|
<Link
|
||||||
target="_blank"
|
target="_blank"
|
||||||
href="https://learn.microsoft.com/azure-data-studio/extensions/azure-cosmos-db-mongodb-extension"
|
href="https://learn.microsoft.com/azure/cosmos-db/mongodb/vcore/migration-options"
|
||||||
>
|
>
|
||||||
Learn more
|
Learn more
|
||||||
</Link>
|
</Link>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user