Nifi Data Enrichment using MongoDBLookup Service in Lookup Record Processor - mongodb-query

I am trying to enrich my incoming flowfile with data from two different mongo collections. Can I configure the MongoDB Lookup Service in such a way that I access two different mongo collections within same processor group in Nifi.
Currently, I am not able to configure the Mongo service for more than one mongo collection.

The MongoDBLookupService will evaluate Expression Langauge and can reference FlowFile Attributes. So if the FlowFile contains an Attribute with the collection name, you can reference that.
However, it will only do one collection at a time, so if each Record needs 2 Lookups, you'll need to do 2 successive LookupRecords.

Related

Store objects with key-value pairs

I have the following data, (All the data will be TEXT).
The following data is for Language files for multi-language translation.
data: {
'MAIN_KEY':{
'A_UNIQUE_KEY':'data1',
'A_UNIQUE_KEY':'data2',
'A_UNIQUE_KEY':'data3',
},
'MAIN_KEY':{
'A_UNIQUE_KEY':'data1',
'A_UNIQUE_KEY':'data2',
'A_UNIQUE_KEY':'data3',
'A_UNIQUE_KEY':'data2',
'A_UNIQUE_KEY':'data3',
},
......
}
Here, the MAIN_KEY will be different for each set. In this case component name, Eg: LOGIN_PAGE
A_UNIQUE_KEY will also different in each case. In this case field name. Eg: USER_NAME and so on.
The number of Key-value pairs in each set will also be different.
I need to store the data for multiple languages. But the MAIN_KEY and A_UNIQUE_KEY will be the same for every file.
Every file will be of the same structure but only the data1, data2.. will be different,
What I want to achieve is that to store and manage the data in this format and later generate a JSON file through an API for my different applications. I should be able to do CRUD operations on this data.
Is creating a Database is the only option here?
XML and JSON are hierarchical structures like a tree, where a parent node can have child nodes and each child node has exactly one parent node, whereas a database is typically a relational system where an entity can have many parents, siblings and children so-to-say :-)
This means in order to store your JSON you have at least these three options:
Create a simple database in an RDBMS where each child table has just one parent table.
Have just one table in an RDBMS and store your JSON in a row in that table. (After all the JSON is just a string.)
Use a non-relational DBMS. There even exist JSON DBMS, if I'm not mistaken.
Which option you choose would depend on your data and what you want to do with it.
I ended up using DynamoDB.
With DynamoDB I can store the data in One Table using the Composite Key. And use DynamoDBMapper to do the CRUD operations.

Cannot create nested documents in Moqui for Elasticsearch

I am not able to explicitly map a particular filed according to my specific requirements.
For example if I take the WorkEffort data model used in HiveMind, then while creating the schema to Index tasks, I cannot specify which type mapping I want to do regarding a specific field.
If I want to nest the details of the Milestones and People associated with a particular task and then query them according to the above values, then I am not able to achieve that.
For example if I want to fetch the results based on the Assignee or the Milestone, I will not be able to achieve that.
So is there any way where I can specify the type of mapping respective to that field, while creating the Document Data for defining a schema according to my choice?
This will allow me to specify which fields are nested and query them accordingly.

Retrieving Documents from Documentum based on the folders name

I am buildng a system that integrates the entities from different data stores on to a unified interface. The eventual target is to build a system that has a capability of querying objects located in multiple datastores on the basis of a unique keys. One of the our datastores is Documentum in which we are keeping all of our documents foldered by their unique names (Keys). The multiple data stores are having a same unique name for a particular entity. The only show stopper here is to get a list of the documents associated with the unique name of certain entity and retrieve the document from documentation. I am searching for a way (a query, or a procedure) to get this task to be done.
You can retrieve all the documents under a folder using the folder predicate in a DQL query:
select * from dm_document where folder('/mycabinet/myfolders/uniquefolder', DESCEND);
Another way to accomplish this is to add a new Documentum Type with a custom attribute to store your unique key. Then you can query directly on that attribute. If you would like to try this route, you should create a new Type that inherits from dm_document.
Then, your query could be like this:
select * from my_new_type where my_custom_attribute = <unique_key>
Folders can be a good solution if it helps you to organize and navigate the data, but they can also create some unique performance challenges. I would suggest against them if your dataset is very large and you don't need to navigate the folder structure.

NHibernate: Returning only two properties of an entity in a Dictionary

We are using Oracle 10g database, NHibernate, WCF and Silverlight 3.0 in our project
The situation we have is that the entities in my project have many properties. But for certain situations, like showing the options in dropdown, I only want to retrieve the list of ID and Name field for that entity. I do not want to return a list of the entire entity object as a whole as there are many columns in the table. Presently I am using two SELECT queries: one to fetch the list of IDs and second to fetch the list of Names separately. Then I join these two queries and form a Dictionary and pass it to the UI.
The concern for me is that would it be possible to achieve this in a single query itself?
One approach that I know of is to create a new class having only the ID and Name property, import it into NHiberante and then form a list of this new class and send it to the UI. I want to avoid this approach for now as there are many tables for which I have to implement this functionality and hence I will have to create many new classes and corresponding xml files.
Any sort of help would be greatly appreciated.
Here is one way to do it using the Criteria API, Projections and AliasToBean. If it's a simple non-persistent class containing Id and Name you can reuse the class. NHibernate query CreateCriteria

Map dynamic/generic properties with NHibernate

I have a scenario where I have a propertybag of key/values that would look something like:
Entry 1 : key="Load", value="2", type="int"
Entry 2 : key="DailyStatus", value="0", type="bool"
I am trying to figure out if it's possible with nhibernate to map these values to a single table that I can pull out at a later time into .net simple types.
I am trying to avoid creating classes to contain all of this data as it can be very repetitive and doesn't allow portions of the application to be as flexible as possible. I had considered storing it in XML or JSON, but this data has to be queried against on a pretty regular basis.
Has anyone mapped dictionaries of simple types to a table in nhibernate and pulled the data back out? I suppose mapping to a generic dictionary would work:
IDictionary<string, IDictionary<object, Type>>
I can do it by hand, but if there is a builtin way for nhibernate to accomplish it that would be easier.
How about you create a class "Triplet" with attriutes id, key, value, type and then map it to a table called whatever you want?