Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Parse data directly from MongoDB cursor?


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Apr 21, 2016 5:58 AM Last Post By: SQL Daddy
Bob Johnson

Posts: 28
Registered: 9/11/15
Parse data directly from MongoDB cursor?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 8, 2016 11:16 PM
How do I parse data directly from the MongoDb cursor? All the samples show basically dumping the cursor to a TMemo. I need to be able to reach in and grab out a specific piece of data from a particular field or better yet copy the cursor into an array which would then give me access to everything.

So the samples do this:

var
oCrs: IMongoCursor;

oCrs := FCon['testdb']['testcollection'].Find();

while oCrs.Next do
Memo1.Lines.Add(oCrs.Doc.AsJSON);

But I want to either dump that data into an array and then be able to manipulate the data to my hearts content or access the cursor and pull out a piece of data and put it into a variable, etc. How can I do this?
Dmitry Arefiev

Posts: 1,406
Registered: 12/7/03
Re: Parse data directly from MongoDB cursor?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 11, 2016 1:14 AM   in response to: Bob Johnson in response to: Bob Johnson
Bob Johnson wrote:

Docu links:
http://docwiki.embarcadero.com/Libraries/Seattle/en/FireDAC.Phys.MongoDBWrapper.TMongoDocument.Iterator
http://docwiki.embarcadero.com/Libraries/Seattle/en/System.JSON.Builders.TJSONIterator

Demos:
* Object Pascal\Database\FireDAC\Samples\DBMS Specific\MongoDB\General -> TfrmMain.btnIterateClick
* Object Pascal\Database\FireDAC\Samples\DBMS Specific\MongoDB\Advanced\MongoAdvanced -> TForm9.Button3Click

--
With best regards,
Dmitry

Edited by: Dmitry Arefiev on Jan 11, 2016 1:15 PM
SQL Daddy

Posts: 6
Registered: 4/8/16
Re: Parse data directly from MongoDB cursor?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Apr 21, 2016 5:58 AM   in response to: Bob Johnson in response to: Bob Johnson
Hello

You can parse data directly from the MongoDb cursor just visit this example it solve this issue.. https://zappysys.com/blog/ssis-loading-data-into-mongodb-upsert-update-delete-insert/

I hope it will help you.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02