Skip to main content

Posts

Check Count, Delete Documents and Drop Collections in MongoDB

Checking the count of documents from collection in MongoDB: In RDBMS, to check the count from table, we need to use count function. In MongoDB also, we have count() method to get the count from collection. Syntax: db.<Collection Name>.count() Example: db.FirstCollection.count(). This query will return the count of total number of records. To get the count of records with specific filter then we need to use find() metho along with count(). Let's say we have records with different Student_Id values in StudentData collection. And we have to find the number of records with Student_Id 201. To do this, we have to pass below query. db.StudentData.find({"Student_Id":201}).count() Delete Documents in MongoDB: In RDBMS, to delete data from table, we need to use DELETE statements.As MongoDB is noSQL database, we have to use remove() method to delete data from collection. Syntax: db.<Collection Name>.remove({<data selection criteria>},{<...

Updating Collection in MongoDB

We can use update() method to update a collection in MongoDB. Basic syntax will be like this: db.<Collection Name>.update(). To update() method, we need to pass the data selection criteria and what we need to update in the selected data. I have a below collection and data. I want to update student name who is having ID 100 in the above collection. To do this, I have to execute below query. We can upsert data as well into collection (Upsert definition: If data exists for the selection criteria then data will be updated otherwise, data will be inserted as new document into collection) To upsert data, we need to pass "upsert":true option to the update() method. In the below example, i am trying to upsert record with Student Id 102. But this 102 does not exist so it should insert as new record. update() will update only first record by default. To update multiple records, we need to pass "true" value for "multi" key in update query...

Creating Collection And Inserting Data in MongoDB

Creating Collection in MongoDB:           We can create a collection in mongoDB using createCollecion(). This method will take collection name as parameter(collection name is the collection which you want to create). Syntax: db.createCollection('<Collection name>',options) Here, we can also pre-allocate space for new collection. This is optional. Let's assume, You have to create a collection with name "FirstCollection". You have to run below command. db.createCollection('FirstCollection') You can see the created collections using command "show collections". Inserting Documents: We can use insert() method to insert documents into a collection. If collection exists then document will be inserted. If not exists, it will create collection first and then it will insert document. Syntax: db.<collection Name>.insert() Below are the sample queries which will insert data into existing collection. Below are the...

Informatica Transformation: Source Qualifier

Source Qualifier is Active Transformation Source Qualifier is connected transformation. It should be there in pipeline. This is default transformation which comes along with source instance when you drag and drop into mapping area.But there is some exceptional case with XML and COBOL sources. This is mandatory transformation to read data from sources and it converts the source data types to the informatica native data types. So, you should not alter the data types of the ports in the source qualifier transformation. If we are not using Push Down Optimization, then every port of source qualifier should have link from source instance. Otherwise, workflow will fail. If we are using Push Down Optimization, then at-least one port of source qualifier should have link from source instance. Otherwise, workflow will fail. Source Qualifier Properties: Below are the Source qualifier properties and there are enable when we are using tables as sources. In case of files as source, th...

Configuring Concurrent Execution of Workflow in Informatica

If there is a requirement to load data into target tables with the same workflow by passing different values for parameters, we knew that we can change parameter file every time to pass new value to parameters. But this requires manual intervention. This manual changes will not be encouraged in production environment for any client. To avoid this manual changes to parameter files every time before you run for particular set, We can use "Configure Concurrent Execution" option from workflow properties. To do this, we need to create different parameter files as per the requirement. To enable concurrent execution, go to EDIT WORKFLOW. We can see the option "Configure Concurrent Execution". Enable this option.Once enabled, one button "Configure Concurrent Execution....." will be enabled. Click on this button and you will get another dialog box. Here, we need to pass parameter file details which we were created earlier. Thank you...And ...

Introduction to Mongo Database

It's been long time, since the last post. Let's get to know about mongo database. So mongo is one of the front runners in nosql databases. Nosql databases do not adhere to rules and principles to standard relational databases. So coming to Mongo it a document oriented database which is written in C++.   Mongo is an open source database. It is simple to install more of a plug and play type.   Once you are done with the mongo installation To start the mongo server in our local machine. Execute the command in command terminal   C:\MongoDB\bin\mongod.exe --config="C:\MongoDB\mongo.config"   To start the client in our local machine execute the following command in the command terminal   C:\MongoDB\bin\mongo   Upon executing we can see the following screen      By default there will be a test database created in our mongo database. So it will be connected to that particular database.   We can create our ...