MongoDB sink options

This page contains a reference of all available options for the MongoDB sink.


  • connectionString: string: the Mongo connection URL of your database. Since the connection string usually contains the username/password you shouldn't set this option from the script, but use the MONGO_CONNECTION_STRING environment variable.
  • database: string: the target database name.
  • collectionName: string: the target collection name.
  • collectionNames: [string]: a list of target collection names. See the "Multiple Collections" page for more information.
  • entityMode: boolean: enable entity mode. See the "Entity storage" page for more information.


  • replaceDataInsideTransaction: bool: if set to true, the sink will use MongoDB transactions to replace data between subsequent pending blocks. Notice that replication is required for this feature to work correctly. If you are using MongoDB Atlas it will work out of the box.
Last modified
Edit on GitHub

Apibara is the fastest platform to build production-grade indexers that connect onchain data to web2 services.

© 2024 GNC Labs Limited. All rights reserved.