Hello everyone,
I'm currently working on utilizing the MongoDB C# / dotNET driver with LabVIEW (https://docs.mongodb.com/ecosystem/drivers/csharp/). My current version of the driver is 2.4.3.23.
After overcoming some basics (missing DDLs for dorNET Core, etc.) things are starting to take shape.
Unfortunately, due to the Async nature of the library (it seems to me that way), there are a few hoops to jump through when processing results from dotNET Invoke Node / Property Nodes...
I'm calling the "ListCollections" method (https://mongodb.github.io/mongo-csharp-driver/2.3/apidocs/html/M_MongoDB_Driver_IMongoDatabase_ListCollections.htm) with an IMongoDatabase refnum.
This works without any errors, but I have troubles handling the result.
According to the documentation it is an "IAsyncCursor<BsonDocument>", which is aimed at being able to be handled asynchronuously (if there is a tutorial out there how to implement that in LabVIEW, I'm very interested).
By looking at this tutorial (https://www.codementor.io/pmbanugo/working-with-mongodb-in-net-2-retrieving-mrlbeanm5) I figured out a way in LabVIEW, but it is one example of complicated code due to programming languages interfaces...
(Thanks to Richard Carpenter from RBX Systems Ltd for the inspiration via his library)
This does not seem like a suitable idea for the long term, and I came across the extension methods for IAsyncCursors (https://mongodb.github.io/mongo-csharp-driver/2.3/apidocs/html/T_MongoDB_Driver_IAsyncCursorExtensions.htm), which offer methods such as "ToList". Casting the dotNET ref from IAsyncCursor to IAsyncCursorExtensions unfortunately didn't offer me any of those methods... (see following picture).
Is there something I'm missing when using the extension methods?
I found a post from the TestStand forums from 2012 (http://forums.ni.com/t5/forums/v3_1/forumtopicpage/board-id/330/thread-id/36029/page/1) that suggest that extension methods are not available.
Is this also the case for LabVIEW?
And regarding the iteration through the IEnumerable pointed to by the cursor: Is there another, more compact or elegant way??
Thank you!
Niels Göran