Questions concerning the MongoDB connector for Matlab

5 views (last 30 days)
Hello,
I am currently testing out the Database Toolbox Interface for MongoDB by MathWorks Computational Finance Team with the mongo function (https://ch.mathworks.com/help/releases/R2020b/database/ug/mongo.html?searchHighlight=mongo&s_tid=doc_srchtitle).
However, I am struggling to find answers to the following, maybe the community can help or someone has already dealt with these issues or found a solution:
  1. Does the interface support ISODate or any datetime query? If so, how should one proceed? The same query would work on MongoDB Compass but the Matlab interface throws me an error. I have seen suggestions on storing datetime objects in another type (integer or float) and then querying on that but I would like to avoid this.
  2. I am seeing people struggling to connect with Atlas, the cloud-hosted database of MongoDB. Is this supported by the interface or has anyone managed to succesfully do this (and with which MongoDB version)?
  3. From my empirical tests, I'm finding that querying is extremly slow compared to Python or Compass. Has anyone else noticed this as well? I originally did the tests on MongoDB 5.0 and downgraded to 4.0 but the issue still persists.
I am using Matlab R2020b and I have done my tests on MongoDB 5.0 and 4.0. Any help would be greatly appreciated.
Thank you.

Answers (1)

Jason Steiner
Jason Steiner on 13 Mar 2023
The mongo read/write speeds in Matlab are slower than Python. If you upgrade to r2022A and get the updated mongo connecter (mongoc) is greatly improves the query time.
From my own benchmarking today the comparison is
720 Documents on the same machine connecting to the same machine, sending the same data.
Matlab --> 6 seconds
Python --> 0.6 seconds

Products


Release

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!