Skip to content

feat(ios): open MongoDB connections - #3771

Merged
datlechin merged 25 commits into
mainfrom
feat/ios-mongodb-driver
Oct 22, 2026
Merged

datlechin merged 25 commits into
mainfrom
feat/ios-mongodb-driver

Conversation

@datlechin

@datlechin datlechin commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

  • MongoDB connections open on iPhone and iPad: synced, imported or created in the form. The Mac plugin and libmongoc 1.28.1 are compiled into the app behind PluginBackedDriver, with a CLibMongoc bridge over the LibMongoc and LibBson xcframeworks published in libs-5 and built by apple/scripts/ios/build-libmongoc-ios.sh, and -lresolv for SRV.
  • The data browser asks a DriverQueryBuilding driver for each page, count and full value, so a collection pages, sorts, filters (every operator but LIKE patterns) and searches in MQL. From MongoDB 4.2 search also matches a number, a date or an ObjectId by its text. Rows edit field by field, insert and delete by _id through the plugin's own statement generator. A value the grid cuts is read whole from the stored document.
  • The query editor splits shell JavaScript at its top level, and Safe Mode counts a statement as a read only when the grammar proves it. MongoStatementParser, MongoStatementClassifier and JavaScriptStatementScanner moved into TableProSQLGrammar so both apps share one read proof. A proven read runs read-only in the shell, as on the Mac. A use moves the table list and the database picker with it.
  • Stop ends a running script on the server: requests to the plugin, catalog reads and counts included, run one at a time and a cancelled one cancels only itself. A resent Stop sends one killSessions per session.
  • A use in the editor moves the picker once its request returns, a stopped one included, and is undone while another window holds unsaved edits. Browsing, counts, value lookups and row writes run in the picker's database even while a script's use has moved the shell.
  • The form edits Hosts (the seed list, stored as mongoHosts with Host and Port set to its first entry), Auth Database, Auth Mechanism, Replica Set and Use SRV Record, under the Mac's keys. Port 27017 by default.
  • Through an SSH tunnel the seed list is dropped and directConnection=true is set, as on the Mac. Verify Identity keeps the CA check and drops only the loopback name check. Verify CA and Verify Identity without a CA file are refused with the reason: OpenSSL on iOS has no trust store.
  • Both apps: an SRV connection through a tunnel is refused, since the driver dialed the resolved servers around the tunnel.
  • Plugin, both apps: X.509 and AWS IAM default the auth database to $external; a URI libmongoc refuses fails with its reason; a client key in its own file is joined with the certificate in a 0600 temporary file; each seed host carries its port once and an IPv6 address keeps its brackets; a save or delete whose _id text reads as two values in the collection, such as an ObjectId and a string, or a double and a decimal, is refused instead of guessed, and an integer past 2^53 is never written as the double it rounds to.
  • Plugin, both apps: a date shows its milliseconds when it has them, so a row keyed by a date names its own document. A row's _id is typed by every kind the collection's finds held, never by a pipeline's group keys or by the last read alone.
  • Redis and MongoDB: no SQL INSERT export, no "Write SQL" empty state, and a statement that is not a proven read reloads the table list.
  • HostListEndpoint moved into TableProConnectionLibrary.
  • Tests changed on purpose, MongoDB swapped for Cassandra as the Mac-only engine or filtered by speaksSQL: IOSDriverFactoryRefusalTests, MacOnlyImportRowTests, ConnectionListRowModelTests, ConnectionLibraryPublisherTests, MacOnlyConnectionFormTests, SQLDDLFallbackPolicyIOSTests, SQLDialectParityTests, SQLBuilderPaginationTests.

Docs: TableProApp/docs#116 (draft).

Test plan

  • New: MongoDBOnIOSTests, MongoDBPluginConnectionTests, MongoDBHostListTests, MongoDBAmbiguousIdentityTests, MongoSessionKillsTests, the stopped-run case in ConnectionCoordinatorCatalogTests, DataBrowserDriverBuiltTests, ConnectionFormViewModelMongoTests, MongoStatementClassifierTests, ConnectionTunnelErrorTests, Mongo cases in the TableProQuery tests, and the session database test in ConnectionManagerTests.
  • Simulator against MongoDB 8: browse, sort, filter, search, paging, a cut value read whole, insert, edit, delete, a split two-statement run, use, a connection naming no database, an SSH tunnel with an unreachable second seed, Stop during a write loop and during a sleep before a write, an ObjectId and string _id pair refused, a date _id with milliseconds and a long past 2^53 each edited in place, an edit after an aggregation on the collection, SRV through a tunnel refused.

Screenshots

Before: a MongoDB connection opens on the Mac only.

Before
Before, dark

After: MongoDB opens; another Mac-only engine keeps the alert.

After, list
After, list, dark
After, collection and document
After, collection and document, dark
After, connection form
After, connection form, dark

# Conflicts:
#	apple/Packages/TableProCore/Sources/TableProDatabase/ConnectionManager.swift
#	apple/Packages/TableProCore/Tests/TableProDatabaseTests/ConnectionManagerTestSupport.swift
#	apple/Packages/TableProCore/Tests/TableProDatabaseTests/ConnectionManagerTests.swift
#	apple/Plugins/ClickHouseDriverPlugin/ClickHouseParameterBinding.swift
#	apple/Plugins/ClickHouseDriverPlugin/ClickHousePlugin.swift
#	apple/Plugins/ClickHouseDriverTests/ClickHouseParameterBindingTests.swift
#	apple/Plugins/ClickHouseDriverTests/ClickHouseTLSConfigurationTests.swift
#	apple/TableProMobile/TableProMobile/Drivers/DriverRowWriting.swift
#	apple/TableProMobile/TableProMobile/Drivers/PluginBackedDriver.swift
#	apple/TableProMobile/TableProMobile/Helpers/RowInserter.swift
#	apple/TableProMobile/TableProMobile/Helpers/RowWriteBatch.swift
#	apple/TableProMobile/TableProMobile/Models/RowLocator.swift
#	apple/TableProMobile/TableProMobile/Platform/IOSDriverFactory.swift
#	apple/TableProMobile/TableProMobile/ViewModels/DataBrowserViewModel.swift
#	apple/TableProMobile/TableProMobile/ViewModels/RowDetailViewModel.swift
#	apple/TableProMobile/TableProMobile/Views/DataBrowserView.swift
#	apple/TableProMobile/TableProMobile/Views/InsertRowView.swift
#	apple/TableProMobile/TableProMobileTests/Drivers/ClickHouseOnIOSTests.swift
#	apple/TableProMobile/TableProMobileTests/Drivers/PluginBackedDriverTests.swift
#	apple/TableProMobile/TableProMobileTests/Helpers/RowWriteRoutingTests.swift
#	apple/TableProMobile/TableProMobileTests/Mocks/StubPluginDriver.swift
#	apple/TableProMobile/project.yml
@datlechin
datlechin enabled auto-merge (squash) October 22, 2026 08:10
@datlechin
datlechin merged commit 8bfe1eb into main Oct 22, 2026
8 checks passed
@datlechin
datlechin deleted the feat/ios-mongodb-driver branch October 22, 2026 12:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant