Skip to content

MongoDB

Nathan Leach edited this page May 7, 2021 · 7 revisions

MongoDB and MongoDB-Compatible APIs

Testing is typically performed with a simple MongoDB installation. Customers have connected CxAnalytix to a clustered MongoDB instance using the MongoDB connection URL that defines primary and secondary cluster nodes. A DocumentDB is also possible using the MongoDB connection URL. The MongoDB URL will need to be XML escaped for parameter separators (e.g. & is replaced by &). Any non-ASCII characters in the URL parameters should be URL Encoded.

A connection to CosmoDB has not been tested but should work the same as when connecting to MongoDB or DocumentDB. One caveat is that the maximum document size for CosmoDB is 2MB where the maximum document size for MongoDB/DocumentDB is 16MB. It is possible that code snippets could push vulnerability detail documents beyond the 2MB limit for CosmoDB.

Bring Your Own Indexing

The MongoDB implementation requires that the user account configured to log into MongoDB has read/write access to tables and collections specified in the configuration. Upon the first run, tables, collections, and some default indexes will be created.

If there are additional indexes desired, it is possible to script your own indexes as needed. This includes indexes with a primary use of calculating a destination shard at the time of write.

The mode of storage in CxAnalytix is intended more as a historical data store than a high-performance, transactional document retrieval system. This means that while it is possible to craft a shard index used to avoid crawling multiple shards, it is outside of the scope of CxAnalytix.

Configuration

If you have already followed the instructions for configuruing the app.config file, you can jump directly to the MongoDB output configuration instructions.

If you are intended to store a lot of historical data for analysis, it may be a good idea to review the Shard Key Cookbook. You are, of course, free to Bring Your Own Indexing but there may be some information in the cookbook that will help you choose a shard key with a cardinality appropriate for your scan volume.