From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Labview interface with MongoDb or similar NoSql database

Can you put on the mongodb's specific program of your first and the second example?Thank you very much!

0 Kudos
Message 21 of 51
(3,831 Views)
Hi mantou,

I'm not sure if I understand what you mean. Do you mean the equivalent program of we were using the mongodb shell? 🐚

Peter

Regards,

Peter D

0 Kudos
Message 22 of 51
(3,818 Views)

 

It is the MongoDB Database specific program you used to your giving the example of the Labview.For example,how you create the MongoDB database, collections and documents. Can you understand?

 

And I also want to know how to use the LabVIEW to insert my collecting data to MongoDB, what kind of functions and controls I can use. It'll be so kind of you If you can give me the complete program.

 

Thank you so much 

0 Kudos
Message 23 of 51
(3,790 Views)

Hi Mantou,

 

I'd put together an example that connects to a database, gets a collection and inserts a document into it.  It is earlier in this thread here - there is some code attached there as an example.

 

Hope that helps.

Peter


Regards,

Peter D

0 Kudos
Message 24 of 51
(3,766 Views)

Alright. I just notice that the example you have given before can insert some data to MongoDB by LabVIEW. But I don't understand how data insert to MongoDB? Just like what I have done before, I use serial, TCP, or some other method to connect my LabVIEW and a external equipment. How is your example achieving to insert a collecting real data from our experiment station to MongoDB?

 

Thank you! 

0 Kudos
Message 25 of 51
(3,755 Views)

@mantou556 wrote:

Alright. I just notice that the example you have given before can insert some data to MongoDB by LabVIEW. But I don't understand how data insert to MongoDB? Just like what I have done before, I use serial, TCP, or some other method to connect my LabVIEW and a external equipment. How is your example achieving to insert a collecting real data from our experiment station to MongoDB?

 

Thank you! 


The connection (which is via a TCP/IP socket) is provied by the MongoDB driver (DLL). You just have to provided the server details, in the form of a connection string, and the driver does the rest 🙂

0 Kudos
Message 26 of 51
(3,648 Views)

Hello,

 

Is there a way to explicitly exclude fields? say for example the _id field?

 

Thanks,

 

-exXo

0 Kudos
Message 27 of 51
(3,559 Views)

 


Hi exXo,

 

Yes there is... When you execute a query, the response comes back as cursor reference. You can invoke the SetFields method on this refernce to select which fields are included or excluded from the returned documents.

 

MongoDB Include or Exclude Fields.png

 

I hope this helps.

Message 28 of 51
(3,552 Views)

Thanks that helped a lot actually.

I'm having problems trying to figure out what to feed the update method. any ideas? it's got a query input as well as an update input. 

 

updatemethod.png

0 Kudos
Message 29 of 51
(3,527 Views)

The Update and Query inputs are for two special classes of BSON document. The Query document is used to specify which documents, within a collection, will be modified (this is sometimes referred to as the filter argument in the MongoDB documentation). And the Update document defines how the documents targeted during the query operation will be modified.

 

The simplest form of update document is just a new document, which then replaces the target document in your database. However, the update document can also include a number of special "operators" which allow you to update the fields in the target document without replacing the whole contents.

 

More on update methods and operators here:

https://docs.mongodb.com/manual/tutorial/update-documents/

https://docs.mongodb.com/manual/reference/operator/update/

 

The example here finds a document with a given _id value and then replaces the entire document using the contents of the update document.

 

MongoDB Simple Update.png

 

Regards,

Hollowhorse

Message 30 of 51
(3,510 Views)