feat(mongodb): support db.getSiblingDB()
This commit is contained in:
1 parent
b44e1080a8
commit
f1e0f54a2b
9 files changed
+262
-8
No files matched your search
@@ -123,6 +123,27 @@ describe("queryStore MongoDB execution summary", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("executes the authoritative inDatabase wrapper against the sibling database and restores the session database", async () => {
|
||||
mocks.mongoFindDocuments.mockResolvedValue({ documents: [{ _id: "1" }], extended_documents: [], total: 1, total_is_exact: true });
|
||||
const { useQueryStore } = await import("@/stores/queryStore");
|
||||
const store = useQueryStore();
|
||||
const tabId = store.createTab("mongo-1", "app", "Query");
|
||||
|
||||
await store.executeTabSql(tabId, 'db.getSiblingDB("reports").events.find();\ndb.users.find()');
|
||||
|
||||
expect(mocks.mongoFindDocuments).toHaveBeenNthCalledWith(1, "mongo-1", "reports", "events", expect.any(Number), expect.any(Number), "{}", undefined, undefined, undefined, expect.any(String));
|
||||
expect(mocks.mongoFindDocuments).toHaveBeenNthCalledWith(2, "mongo-1", "app", "users", expect.any(Number), expect.any(Number), "{}", undefined, undefined, undefined, expect.any(String));
|
||||
const tab = store.tabs.find((item) => item.id === tabId)!;
|
||||
expect(tab.batchSqlExecution).toMatchObject({
|
||||
total: 2,
|
||||
completed: 2,
|
||||
items: [
|
||||
{ status: "success", statementIndex: 0 },
|
||||
{ status: "success", statementIndex: 1 },
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("forwards the active execution ID to a pending explain and its cancellation", async () => {
|
||||
let rejectExplain!: (reason: Error) => void;
|
||||
mocks.mongoExplainFind.mockImplementation(
|
||||
|
||||
Reference in new issue
Block a user