<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: tMongoDBRow in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/tMongoDBRow/m-p/2264938#M44626</link>
    <description>Hi Johan 
&lt;BR /&gt;When I look into the generated code of tMongoDBRow component, I see that this component do not assign command result to a schema column, except printing the result on the console. 
&lt;BR /&gt; 
&lt;PRE&gt;		com.mongodb.CommandResult result_tMongoDBRow_1 = null;&lt;BR /&gt;							result_tMongoDBRow_1 = db_tMongoDBRow_1&lt;BR /&gt;									.doEval("function(name,age){  return db.person.save({name:name,age:age});}",&lt;BR /&gt;											row1.name, row1.age);&lt;BR /&gt;							if (result_tMongoDBRow_1.ok()) {&lt;BR /&gt;								System.out.println(result_tMongoDBRow_1);&lt;BR /&gt;							} else {&lt;BR /&gt;								System.err.println(result_tMongoDBRow_1);&lt;BR /&gt;							}&lt;/PRE&gt; 
&lt;BR /&gt;So, you can't use tMongoDBRow to search records from MongoDB now. 
&lt;BR /&gt;Shong</description>
    <pubDate>Wed, 25 Dec 2013 16:23:06 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-12-25T16:23:06Z</dc:date>
    <item>
      <title>tMongoDBRow</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMongoDBRow/m-p/2264937#M44625</link>
      <description>Hi all, 
&lt;BR /&gt;I've been scratching my head on this one; 
&lt;BR /&gt;How do I get the output of the command I run in tMongoDBRow for use in the next component? 
&lt;BR /&gt;Here's what needs to be done: 
&lt;BR /&gt;I get a list of (qualifying) entries from MongoDB via the tMongoDBInput, I use the "Name" column from the results to do a fts search via the tMongoDBRow component, for example: 
&lt;BR /&gt;Function: "db.compds.runCommand('text', {search: '" + row1.Name + "', filter: {'ClassId':'SOFTWARESERVER'}, project: {ReconId: 1}})" 
&lt;BR /&gt;Then, I would ideally have a tExtractJSONFileds component to extract the "score" and "ReconId" from the ^resultset for further decisioning and processing. 
&lt;BR /&gt;Any solution to accomplish this would be appreciated, it doesn't have to be the tMongoDBRow component. 
&lt;BR /&gt;Regards and happy holidays, 
&lt;BR /&gt;Johan.</description>
      <pubDate>Mon, 23 Dec 2013 00:36:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMongoDBRow/m-p/2264937#M44625</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-23T00:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: tMongoDBRow</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMongoDBRow/m-p/2264938#M44626</link>
      <description>Hi Johan 
&lt;BR /&gt;When I look into the generated code of tMongoDBRow component, I see that this component do not assign command result to a schema column, except printing the result on the console. 
&lt;BR /&gt; 
&lt;PRE&gt;		com.mongodb.CommandResult result_tMongoDBRow_1 = null;&lt;BR /&gt;							result_tMongoDBRow_1 = db_tMongoDBRow_1&lt;BR /&gt;									.doEval("function(name,age){  return db.person.save({name:name,age:age});}",&lt;BR /&gt;											row1.name, row1.age);&lt;BR /&gt;							if (result_tMongoDBRow_1.ok()) {&lt;BR /&gt;								System.out.println(result_tMongoDBRow_1);&lt;BR /&gt;							} else {&lt;BR /&gt;								System.err.println(result_tMongoDBRow_1);&lt;BR /&gt;							}&lt;/PRE&gt; 
&lt;BR /&gt;So, you can't use tMongoDBRow to search records from MongoDB now. 
&lt;BR /&gt;Shong</description>
      <pubDate>Wed, 25 Dec 2013 16:23:06 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMongoDBRow/m-p/2264938#M44626</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-25T16:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: tMongoDBRow</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMongoDBRow/m-p/2264939#M44627</link>
      <description>&lt;A href="https://jira.talendforge.org/browse/TDI-28471" rel="nofollow noopener noreferrer"&gt;https://jira.talendforge.org/browse/TDI-28471&lt;/A&gt;</description>
      <pubDate>Thu, 26 Dec 2013 03:51:17 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMongoDBRow/m-p/2264939#M44627</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-12-26T03:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: tMongoDBRow</title>
      <link>https://community.qlik.com/t5/Talend-Studio/tMongoDBRow/m-p/2264940#M44628</link>
      <description>&lt;P&gt;The MongoDB driver is still very poor.&lt;/P&gt; 
&lt;P&gt;As a workaround, you can use a tJavaFlex to use the MongoDB database object and do anything you want.&lt;/P&gt; 
&lt;P&gt;Here's an example of a tJavaFlex that get custom indexes, drop and returns them in output.&lt;/P&gt; 
&lt;P&gt;This code assumes you have added a tMongoDbConnection named "tMongoDBConnection_1", so its db object is named "db_tMongoDBConnection_1" (you will find this in the "code" tab).&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;P&gt;&lt;STRONG&gt;Advanced settings &amp;gt; Import :&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;import com.mongodb.client.MongoDatabase;
import com.mongodb.util.JSON;
import java.util.ListIterator;&lt;BR /&gt;import java.util.ArrayList;&lt;/PRE&gt; 
&lt;P&gt;&lt;STRONG&gt;Basic settings &amp;gt; Main code :&lt;/STRONG&gt;&lt;/P&gt; 
&lt;P&gt;&amp;nbsp;&lt;/P&gt; 
&lt;PRE&gt;MongoDatabase database = (MongoDatabase)globalMap.get("db_tMongoDBConnection_1");
org.bson.Document indexesResult = database.runCommand(new org.bson.Document("listIndexes", context.collection));
ArrayList indexes = (ArrayList)((org.bson.Document)indexesResult.get("cursor")).get("firstBatch");
ListIterator&amp;lt;org.bson.Document&amp;gt; iter = indexes.listIterator();
org.bson.Document indexDoc;

while (iter.hasNext()) {
  indexDoc = iter.next();
  if (indexDoc.getString("name").equals("_id_")) {
    iter.remove();
  }
  else {
    indexDoc.remove("v");
    indexDoc.remove("ns");
  }
}
row1.indexes = JSON.serialize(indexes);
database.runCommand(new org.bson.Document(routines.Mongo.formatDropIndexesCommand(context.collection)));&lt;/PRE&gt; 
&lt;P&gt;Then in the tJavaFlex schema, I added a "indexes" String field.&lt;/P&gt;</description>
      <pubDate>Sat, 02 Mar 2019 11:26:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/tMongoDBRow/m-p/2264940#M44628</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-03-02T11:26:53Z</dc:date>
    </item>
  </channel>
</rss>

