Direct Access
Access the database directly.

Connect directly to the Mongo DB instance that runs on your Moralis Server

You find the Mongo DB IP and port in your Moralis Dapp settings, you will also need to whitelist the IP that will connect to that mongo DB instance (also in Dapp settings).

Node.js

1
const { MongoClient } = require('mongodb');
2
โ€‹
3
const MONGO_HOST = 'MONGO_HOST_IP_FROM_ADMIN_INTERFACE';
4
const MONGO_PORT = 'MONGO_HOST_PORT_FROM_ADMIN_INTERFACE';
5
โ€‹
6
// Create a new MongoClient
7
const client = new MongoClient(`mongodb://${MONGO_HOST}:${MONGO_PORT}`);
8
โ€‹
9
async function run() {
10
try {
11
// Connect the client to the server
12
await client.connect();
13
// Establish and verify connection
14
await client.db('admin').command({ ping: 1 });
15
console.log('Connected successfully to server');
16
} finally {
17
// Ensures that the client will close when you finish/error
18
await client.close();
19
}
20
}
21
run().catch(console.dir);
Copied!

Python

1
import pprint
2
import pymongo
3
โ€‹
4
MONGO_HOST = "MONGO_HOST_IP_FROM_ADMIN_INTERFACE"
5
MONGO_PORT = MONGO_HOST_PORT_FROM_ADMMIN_INTERFACE
6
โ€‹
7
con = pymongo.MongoClient(MONGO_HOST, MONGO_PORT)
8
user_table = con['parse']['_User']
9
pprint.pprint(user_table.find_one())
Copied!
Note: _User table is a particular example of table that starts with _, most of the tables will not start with _.
After you have established direct access to Mongo DB, you can do your own dumps for the database or use a tool with an interface to see what is in the database. You can also add indexes where needed.