MongoDB · NoSQL · documents
Local MongoDB or Atlas on Android?
Short answer
No local MongoDB server runs on an Android phone in PocketCode — Atlas, or any MongoDB you can reach over the network, does. With Atlas you connect with a service account or an API key, pick a cluster and open its database with the database user and password you type. For your own MongoDB server, PocketCode's built-in client (SCRAM auth, TLS) lists the collections and their counts; it does not show the documents inside them. The one database that runs on the phone itself is the embedded PostgreSQL.
How to connect
MongoDB Atlas
- 1Connect your Atlas account in Settings → Integrations → Connected Services, with a service account or an API key.
- 2Open the Atlas account in the Database module: it lists your clusters.
- 3Pick a cluster. The connection form opens with the SRV host filled in: type the database user and password (Atlas doesn't hand them out through its API) and save.
- 4Open the connection to see the database's collections and how many documents each holds. Test Connection can't check an Atlas connection yet, so opening it is the test.
Your own MongoDB server
- 1In My Connections, tap + (New Connection).
- 2Paste your mongodb:// or mongodb+srv:// URI in Connection String and tap Parse Connection String, or choose MongoDB in Database Type and fill host, port, database, user and password.
- 3Tap Test Connection: it opens the socket, negotiates TLS and completes the SCRAM login, so a green answer means the credentials work. Then tap Save.
- 4Open it to list the collections of the database named in the connection (test when the field is empty), with their document counts.
What you can do with it
- List the collections of your Atlas cluster's database from your phone
- Check the document count of each collection (the first 40 collections show a count)
- Test the connection to your own MongoDB server before saving it: a real ping with TLS and the SCRAM login
- Read the database users of an Atlas project, read-only, in Security → Roles
- Connect by browsing your Atlas account instead of pasting a URI
- Check your own MongoDB server over the network: collections and document counts
Good to know
MongoDB Atlas is a cloud NoSQL service, so it needs internet and the data lives on Atlas's servers. PocketCode lists collections and their counts, but in this version it does not show the documents inside them, and its MongoDB shell and aggregation builder are not reachable; it doesn't host the cluster or run a local MongoDB server on the device. If you need a database that lives on the phone, use the embedded PostgreSQL.
Questions
Can I run MongoDB locally on my Android phone?
Not in PocketCode: no MongoDB server runs on the device. It connects to Atlas or to a MongoDB you reach over the network. The database that does run on the phone itself is the embedded PostgreSQL.
Is this a way to use MongoDB Atlas with Android Studio?
No. PocketCode isn't Android Studio and doesn't add MongoDB to an Android app you build. It is a client on your phone: if your app keeps its data on Atlas, you can open that cluster from the phone and check its collections and how many documents each holds.
Can I read or edit the documents?
Not in this version. You get the collections and their counts (the first 40 collections show a count). There is no MongoDB shell, no aggregation builder and no screen to create collections or manage indexes.
Does it need an internet connection?
Yes. Atlas is a cloud service and your own server is reached over the network. A mongodb+srv:// host is resolved with DNS over HTTPS, against dns.google with cloudflare-dns.com as the fallback; your data goes from the app to your cluster, never through a PocketCode server.