LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview interface with MongoDb or similar NoSql database

Hi Hollowhorse,

Thanks for that swift reply.

Is it possible to access MongoDB using HTTP POST and GET methods?

Also, it possible to do the same using Wire Protocol (TCP Socket)?

Regards,

Saptarshi Pan

0 Kudos
Message 41 of 51
(1,633 Views)

Hi Saptarshi,

 

Well.... anything is possible 😉

I did look at using the HTTP POST and GET methods originally, but the functionality was very limited at the time.

It's definitely possible to use Wire protocol, but that means writing your own drivers from scratch. That's something which has always appealed to me, but I've never had the time (or foolhardiness) to try it.

 

Regards,

Hollowhorse

0 Kudos
Message 42 of 51
(1,624 Views)

Hi, Hollowhorse

What do I to get the N documents from MongoDB in LabView?

I tried a few things, but I believe it would be best if we can replicate this command line statement db.collectionName.find({"_id": 0}).sort({"_id": -1}).limit(100).pretty(). Can we do this using the RBX Systems Driver

0 Kudos
Message 43 of 51
(1,593 Views)

Hi Saptarshi,

 

That's an odd query seeing as MongoDB normally forces unique values for _id. In theory you can only ever have one instance where _id = 0. Regardless, I have written some LabVIEW code to replcate your query. I have to be honest, handelling .NET in LabVIEW is quite longwinded - so the code looks more complicated than it actually is. As I've said before, I'd advise encapsulating some of the common .NET driver functions into VI's.

 

hollowhorse_0-1582200637080.png

 

I'm afraid I can't comment on the RBX driver. At the time I was working on my project it didn't do what I needed, but it may have come on since then.

 

Regards,

hollowhorse

Download All
0 Kudos
Message 44 of 51
(1,582 Views)

Hi all,

 

I tried to access database with user/password without success.I have always same error:

 

Constructor Node Error creating instance of MongoClient in assembly MongoDB.Driver.MongoClient, MongoDB.Driver, Version=1.8.3.9, Culture=neutral, PublicKeyToken=f686731cfb9cc103, (System.NotSupportedException: Unsupported MongoAuthenticationMechanism SCRAM-SHA-1.) <append><b>System.NotSupportedException</b> in TestMongoDB.vi

 

Connection string like:

 

mongodb://user:passw@host/admin?authMechanism=SCRAM-SHA-1

 

What is wrong? Database is 4.0.

 

Thanks in advance!!!

 

0 Kudos
Message 45 of 51
(1,460 Views)

What would i need to do to open the MongDB Test.vi without having the project open.  I would like to add this to the code that I am currently working to develop some reusable code outside of a project scenario.

HMunster_0-1635254183154.png

It is broken without the project open and when I try to right click and select a constructer I can browse to the mongodb.driver.dll  but when opening I get "An error occurred trying to load assembly."

HMunster_1-1635254358097.png

I think this can sometimes be caused by one dll being dependent on another and that they may need to be in the same directory.  The MongoDB.Bson.dll and MongoDB.Driver.dll are in the same folder but the mscorlib.dll is not and I find 81 versions of this on my PC.  I tried moving a couple of them into the same folder but it did not help.

 

Is there a way to do this?

 

 

0 Kudos
Message 46 of 51
(1,159 Views)

Has anyone been able to solve this issue?

 

I am facing a problem with loading the latest "MongoDB.Driver.dll" in LabVIEW. Strangely, when I load the 2014 version of the DLL, LabVIEW accepts it without any issues. However, when I attempt to load the latest version, I encounter the same error as HMunster reported earlier. I've tried using both LabVIEW 32-bit and 64-bit versions, but unfortunately, I haven't had any success in resolving the problem.

If anyone has encountered a similar issue or has any insights into resolving this problem, I would greatly appreciate your input.

Kind Regards,
Jacques

 

0 Kudos
Message 47 of 51
(603 Views)

I'm still using a really old version of the C# driver in LabVIEW. It doesn't support some of the newer features, like transactions and the Decimal128 data type, but it works perfectly fine in all other respects. 

0 Kudos
Message 48 of 51
(592 Views)

This was great got this example working at one point, but now that I need to use it with the latest Mongodb it no longer works.  Does anyone have an idea why?  Using LabVIEW 2021, Mongodb 5.0.6 2008R2PLUS SSL(64Bit) worked but with MongoDB 6.0.8 2008R2Plus SSL (64Bit) it does not work.

0 Kudos
Message 49 of 51
(576 Views)

I came right! 

 

For some reason using the "Signed" version of the driver worked, but the only one I could find was version 2.19 just shy of 2.20 but still good enough.

To get started, open Visual Studio and access the "NuGet Package Manager Console." Install the below provided NuGet packages and then compile the DLLs. Remember to create a dummy DotNet project first before executing the commands else it will not work. After successful compilation, you can locate the DLLs stored folder location under the "References" section in the right column.


NuGet Gallery | MongoDB.Bson.signed 2.19.0
NuGet Gallery | MongoDB.Driver.signed 2.19.0

Kind Regards
Jacques.

0 Kudos
Message 50 of 51
(555 Views)