/ examples / mongo / README.md
README.md
 1  # Apibara 🤝 MongoDB
 2  
 3  _Mirror onchain data to a MongoDB collection._
 4  
 5  **Use cases**
 6  
 7  - Start collecting data quickly, without worrying about table schemas.
 8  - Build the backend for you dapp.
 9  - Create complex analytics queries using the Mongo Pipeline API.
10  
11  **Usage**
12  
13  You must set the `MONGO_CONNECTION_STRING` environment variable to the one
14  provided by your MongoDB provider.
15  
16  For developing locally, we provide a `docker-compose.yml` file that starts
17  MongoDB and Mongo Express. Run it with:
18  
19  ```
20  docker compose up
21  ```
22  
23  Then export the following environment variable:
24  
25  ```
26  export MONGO_CONNECTION_STRING='mongodb://mongo:mongo@localhost:27017'
27  ```
28  
29  You can then run the script with `apibara run`. Visit
30  http://localhost:8081/db/example/transfers to see a list of all documents being
31  inserted by Apibara into your collection. You can check on the progress by
32  refreshing the page.