Open rtclauss opened 2 years ago
An index against the owner field in Mongo/DocumentDB really helps performance. here is the mongo shell command to create the index:
owner
use stocktraderhistory; db.test_collection.createIndex({"owner":1},{name:"owner_asc"})
We should be able to create this index programmatically in MongoConnector by changing the constructor from:
public MongoConnector(MongoClient mClient, String mongoDatabase, String mongoCollection) { mongoClient = mClient; database = mongoClient.getDatabase(mongoDatabase); database.createCollection(mongoCollection); tradesCollection = database.getCollection(mongoCollection); }
to
public MongoConnector(MongoClient mClient, String mongoDatabase, String mongoCollection) { mongoClient = mClient; database = mongoClient.getDatabase(mongoDatabase); database.createCollection(mongoCollection); tradesCollection = database.getCollection(mongoCollection); tradesCollection.createIndex(Indexes.ascending("owner")); }
Might need to catch an exception if the index already exists
An index against the
owner
field in Mongo/DocumentDB really helps performance. here is the mongo shell command to create the index:We should be able to create this index programmatically in MongoConnector by changing the constructor from:
to