<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ender Kaderli on Medium]]></title>
        <description><![CDATA[Stories by Ender Kaderli on Medium]]></description>
        <link>https://medium.com/@enderkaderli?source=rss-fb5a6dc5b9f2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*TyA8E_sR5hvBU7gDiMnm8A.jpeg</url>
            <title>Stories by Ender Kaderli on Medium</title>
            <link>https://medium.com/@enderkaderli?source=rss-fb5a6dc5b9f2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 16:29:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@enderkaderli/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[DATA INTEGRATION AND ITS IMPORTANCE FOR BUSINESS]]></title>
            <link>https://medium.com/@enderkaderli/data-integration-and-its-importance-for-business-fff1d99839d4?source=rss-fb5a6dc5b9f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/fff1d99839d4</guid>
            <category><![CDATA[data-integration]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[data-governance]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Ender Kaderli]]></dc:creator>
            <pubDate>Mon, 21 Jul 2025 01:37:07 GMT</pubDate>
            <atom:updated>2025-07-21T01:37:07.730Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>1.Introduction</strong></blockquote><p>Data integration is critical for modern businesses to operate effectively. The ability to ensure consistent and reliable information flow between different systems and sources supports organizations in achieving their strategic goals. Bringing together separate data sources increases efficiency and provides a more solid foundation for decision-making processes. In this context, it enables businesses to manage their data analysis and reporting processes more effectively. Data integration also plays an important role in cost savings. When distributed systems work together, resources can be used more efficiently, which reduces overall costs. In addition, collecting and updating data in a single source allows users to make faster decisions by preventing unnecessary time loss. In conclusion, ensuring data integration presents a great opportunity for businesses to gain a competitive advantage. In addition, it improves customer experiences and enables businesses to provide better services. It is crucial for businesses to adopt a more systematic approach to data management in order to overcome the challenges they may encounter in this process.</p><blockquote><strong>2. What is Data Integration?</strong></blockquote><p>Data integration is the process of bringing together data from different sources, making it compatible, and obtaining meaningful information. This process eliminates data silos in organizations, allowing data to be viewed as a single whole. Data integration is not only a technical solution but also a strategic approach. Bringing together data stored in different systems makes it easier for users to access data and speeds up analysis processes.</p><p>Data integration can be performed at both the physical and logical levels. Physical integration involves the physical merging of data, while logical integration uses data modeling to bring together data from different sources. Data warehouse integration refers to systems where large data sets are compiled for analytical purposes. Such integrations ensure that data is both processable and analyzable.</p><p>Data collection is a complex process that includes data cleaning, data transformation, and data loading. Data collection refers to obtaining data from various sources. The incoming data must be cleaned to improve its quality; this stage involves filtering out incorrect or incomplete information. Subsequently, the data must be transformed to be in the desired format. Finally, the integrated data is loaded into the target systems.</p><p>Each of these processes is aimed at improving data quality and ultimately obtaining more accurate and reliable information. Innovative technologies make data integration processes more effective while forming a critical foundation for data analytics and business intelligence applications.</p><blockquote><strong>3. The Importance of Data Integration</strong></blockquote><p>Data integration is vital for businesses to make strategic decisions today. Bringing together different data sources creates a more comprehensive and accurate information base. Access to reliable data in decision-making processes facilitates analysis and strategic planning for managers. Additionally, through integration, organizations can collect data from multiple systems on a single platform, enabling faster and more effective decision-making. This simplifies the management of complex data structures while minimizing time loss. Furthermore, data integration enables businesses to increase their efficiency. Ensuring data flow between different systems supports the automation of business processes and reduces manual operations. As a result, employees can focus on more strategic tasks, and overall workforce efficiency increases. Cost savings are also one of the main advantages of data integration. Integrated data systems reduce repetitive data processing costs and enable more efficient use of resources. Businesses gain the ability to respond more quickly to customer requests by shortening data acquisition and processing times. Additionally, improving data quality can prevent erroneous decisions. In conclusion, data integration improves decision-making processes, increases efficiency, and reduces costs, thereby enhancing overall business performance. For this reason, data integration has become a strategic necessity for modern businesses.</p><blockquote><strong>4. Types of Data Integration</strong></blockquote><p>Types of data integration encompass various methods applied in the process of bringing together different data sources. <strong>Physical integration</strong> is achieved by collecting data from different systems under a single physical structure. This type of integration is typically applied in central storage systems such as databases or data warehouses and ensures that data is kept up to date. Users can simplify data management and access by opting for physical integration.</p><p><strong>Logical integration,</strong> on the other hand, is based on bringing data sources together logically rather than physically when it is necessary to combine data. This method enables data from different systems to be processed dynamically and allows data to remain independent. Logical integration accelerates data access between systems by providing flexibility.</p><p><strong>Data warehouse integration</strong> is an important step in creating corporate data pools. This type of integration aims to store data in an organized manner for analysis and reporting purposes. Data warehouses play a critical role in combining data from different sources and contribute significantly to decision-making processes by supporting data analytics processes.</p><p>In conclusion, each type of data integration has its own advantages and areas of application. Effective use of these types helps optimize the management and use of data sources.</p><blockquote><strong>5. Data Integration Process</strong></blockquote><p>The data integration process represents one of the most important stages in data management. This process consists of four basic stages: <strong>data collection, data cleansing, data transformation, and data loading.</strong> The first stage, <strong>data collection,</strong> involves gathering data from different sources. At this stage, the quality and validity of the data should be considered, and various data sources should be preferred. Then, the <strong>data cleansing</strong> stage begins, where errors, omissions, and inconsistencies in the collected data are corrected. This process is critical for obtaining high-quality and usable data.</p><p>The third stage involves <strong>data transformation.</strong> In this stage, the cleaned data is organized into the desired format and structure. Data transformation includes processes such as standardizing, merging, or converting data. This step is necessary to ensure that the data can be used in different systems and applications.</p><p>Finally, the <strong>data loading</strong> stage takes place. In this stage, the transformed data is placed in appropriate databases or data warehouses. The correct loading of data is vital for the integrity and performance of systems.</p><p>The data integration process is successful when these four stages are effectively implemented, enabling organizations to make the best use of the data they obtain from different data sources. As a result, this process supports decision-making processes and increases efficiency by improving the effectiveness of databases and information systems.</p><blockquote><strong>6. Effects of Data Integration</strong></blockquote><p>The effects of data integration play an important role in the restructuring of organizational business processes. The effects on business processes are improved by combining data. Integrated data enables employees to instantly access all the information they need, allowing work to be carried out more quickly and efficiently. This results in simplified and optimized processes instead of complex and time-consuming ones. Data integration is also at the forefront in terms of customer experience. Customer requests and feedback can be better analyzed through integrated data, enabling the provision of services and products that align with customer needs and expectations. This not only increases customer satisfaction but also helps build loyalty and long-term relationships.</p><p>Competitive advantage is one of the most important effects of data integration. Adapting quickly to market conditions provides an opportunity to stay ahead of competitors. Integrated data enhances the ability to respond to market demands and changes, enabling organizations to become more flexible and dynamic. Additionally, rapid data analysis makes strategic decision-making processes more information-driven. As a result, organizations become better prepared for changes in external conditions and their ability to respond also improves.</p><p>In conclusion, the effects of data integration revolve around elements such as increasing the efficiency of business processes, ensuring customer satisfaction, and creating a competitive advantage. These effects not only improve organizational performance but also contribute to sustainable growth and development.</p><blockquote><strong>7. Future Trends</strong></blockquote><p>Artificial intelligence is bringing about revolutionary changes in the field of data integration. The development of algorithms is making data analysis faster and more effective, while increasing organizations’ capacity to process large amounts of data. AI-powered systems have the ability to automatically combine data from different sources to generate meaningful insights. This process not only manages data volumes but also provides a significant advantage in integrating this data into business processes to gain a competitive edge.</p><p>Real-time data integration has become a critical component in enabling businesses to provide instant data flow in their decision-making processes. Instant data updates not only improve the user experience but also provide flexibility in areas such as marketing strategies and customer relationship management. Thanks to this trend, businesses can respond quickly to market dynamics.</p><p>Cloud-based solutions make data integration and management more flexible and scalable. Cloud-based platforms reduce costs and make data sharing more accessible by facilitating the integration of different systems. Additionally, cloud infrastructures offer various features that enhance data security, helping businesses meet their data protection requirements.</p><p>These future trends make data integration even more important, enabling organizations to increase their efficiency and gain a competitive advantage. Successful integration strategies are an indispensable element for adapting to the dynamics of the era.</p><blockquote><strong>8. Conclusion</strong></blockquote><p>Data integration is a critical tool for improving business efficiency and enhancing strategic decision-making processes. Modern businesses can perform more comprehensive and meaningful analyses by bringing together data from different sources. This enables effective business decisions, accurate assessment of market trends, and a better understanding of customer needs. The consistent and integrated data sets obtained through data integration form a solid foundation for analytical work. The improvements it brings to business processes result in time savings and more efficient use of resources. Data integration enhances the speed and efficiency of a specific business process, giving the business a competitive advantage. By implementing data integration applications, businesses have the opportunity to develop proactive solutions to the challenges they face. This process not only ensures the compatibility of existing systems but also reduces security and data quality issues, creating a more robust infrastructure. Future expectations suggest that data integration will evolve with artificial intelligence, real-time data processing, and cloud-based solutions. These developments will further strengthen businesses’ decision-making mechanisms by offering smarter and faster data solutions. In conclusion, data integration has become a strategic necessity in today’s business world and is an indispensable element for businesses to achieve success.</p><blockquote><strong>Please contact us for support with data integration processes.</strong></blockquote><blockquote><strong>Stay connected with data.</strong></blockquote><blockquote><strong>Contacts</strong></blockquote><blockquote><strong>Linkedin </strong>: Ender Kaderli</blockquote><blockquote><strong>E-Mail :</strong> enderkaderli@datapaper.ai</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fff1d99839d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WHICH CUSTOMER HAS PRIORITY ?]]></title>
            <link>https://medium.com/@enderkaderli/which-customer-has-priority-3f23900443eb?source=rss-fb5a6dc5b9f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/3f23900443eb</guid>
            <category><![CDATA[cost-optimization]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[crm]]></category>
            <category><![CDATA[marketing]]></category>
            <category><![CDATA[customer-segmentation]]></category>
            <dc:creator><![CDATA[Ender Kaderli]]></dc:creator>
            <pubDate>Fri, 11 Jul 2025 02:12:20 GMT</pubDate>
            <atom:updated>2025-07-11T02:12:20.212Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>WHICH CUSTOMER HAS PRIORITY ?</strong></h3><p>Customer prioritization is a vital component of sustainable success for modern businesses. In order to cope with the various challenges they face and dynamic market conditions, businesses must segment their customer bases and develop specific strategies for each segment. Since no company has unlimited resources, and customers also have limited resources, customer prioritization has become more than just a strategy — it is a necessity that ensures these strategies are implemented most effectively, highlighting the customer’s value and the potential benefits they provide to the company.</p><p>In this context, customer prioritization criteria are generally based on several key factors, <strong>including customer relationships, purchase history, potential revenue, collaboration opportunities, and long-term loyalty.</strong> Businesses can use this information to focus on a specific customer group, allocate their resources more effectively, and thus increase cost efficiency.</p><p>On the other hand, customer prioritization should be considered not only as a sales-boosting tool but also as a strategic dimension that increases customer loyalty, enhances brand value, and strengthens the company’s position in the market. The effective use of analytical methods and customer data is essential for businesses to remain competitive in the global market.</p><blockquote><strong>WHAT IS CUSTOMER PRIORITIZATION ?</strong></blockquote><p><strong>Customer prioritization is the process of classifying a business’s existing and potential customer portfolio according to specific criteria to determine the importance and value of each segment.</strong> This concept emerges as an important strategic tool, especially in highly competitive markets. Customer prioritization plays a critical role not only in achieving sales targets but also in improving customer satisfaction and focusing on long-term relationships.</p><p>This process is typically carried out by evaluating customer segments based on various criteria. These criteria include <strong>financial indicators such as the customer’s purchasing potential, payment history, customer lifetime value (CLV), and customer loyalty,</strong> as well as <strong>demographic information, industry analysis,</strong> <strong>and customer feedback.</strong> For example, high-value but low-loyalty customers may be prioritized, while a segment of loyal but low-spending customers may be identified as an area that needs to be strengthened. In this way, companies not only adopt a profit-driven approach but also improve customer relationships and solidify their position in the market. The importance of customer segmentation is thus clearly evident in this context.</p><blockquote><strong>CUSTOMER SEGMENTATION</strong></blockquote><p><strong>Customer segmentation is a systematic process that an organization undertakes to understand different customer groups in the market and develop appropriate strategies to serve them more effectively.</strong> The primary goal is to analyze customer needs and expectations to form subgroups. This process enables companies to use their resources more efficiently, adopt a targeted approach in marketing communications, and develop strategies that enhance customer satisfaction. Customer segmentation can be approached in three main dimensions: <strong>demographic, psychographic, and behavioral segmentation.</strong></p><p><strong>Demographic segmentation</strong> is the process of identifying customer groups based on quantitative data such as age, gender, income level, and education status. This type of segmentation allows for the differentiation of a broad customer base based on distinct characteristics such as gender and age, while forming the basis of marketing strategies. For example, considering that young consumers tend to shop more on digital platforms, digital marketing strategies can be developed to organize special campaigns for them. In this way, businesses can gain a competitive advantage by offering personalized offers to specific demographic groups.</p><p><strong>Psychographic segmentation</strong> is a differentiation technique based on individuals’ lifestyles, values, interests, and attitudes. This dimension offers a more qualitative approach to understanding customers’ purchasing behaviors in depth. For example, a group of customers who are oriented toward environmentally friendly products may show a tendency to prefer brands that reflect their values and lifestyles when choosing these products. Finally, <strong>behavioral segmentation</strong> is based on performance-related data such as customers’ purchasing habits, loyalty levels, and product usage frequency. This type of segmentation helps companies identify the diverse needs and expectations within their existing customer base while enabling the development of effective marketing and sales strategies. All three types of segmentation are critical to implementing a customer-centric approach in today’s competitive market conditions.</p><blockquote><strong>PRIORITIZATION PROCESS</strong></blockquote><p>This process also allows customers to be classified according to predefined criteria. Some common methods that can be used to determine priorities include <strong>customer lifetime value (CLV), customer satisfaction scores,</strong> and <strong>market demand.</strong> It should also be understood that such criteria have a dynamic structure and need to be revised according to changing market conditions over time. The effectiveness of the system can be enhanced by taking into account customer feedback, market analysis, and competitive strategies.</p><p>Advancing technologies and artificial intelligence applications are taking prioritization processes further by strengthening data-driven decision-making mechanisms. Analytical tools that provide in-depth insights into customer interactions and behaviors help companies prioritize more accurately and effectively. In summary, the prioritization process deepens customer relationships while highlighting high-value customer segments in line with the company’s goals. In this context, effective management of the prioritization process plays an important role in strengthening customer loyalty and financial success in the long term.</p><blockquote><strong>CUSTOMER PRIORITIZATION EXAMPLES</strong></blockquote><p>Customer prioritization examples include strategies and methods applied in various industries, thereby enabling companies to direct their resources in the most effective way. As an example, companies in the e-commerce sector segment their customers based on their purchase history and behavior. For example, an online retailer can analyze frequent shoppers and those with low purchase frequency in terms of costs and profit margins, and target frequent shoppers with special campaigns and discounts. Such an approach not only increases customer loyalty but also presents opportunities to maximize revenue.</p><p>Additionally, in B2B (business-to-business) sectors, customer prioritization is typically based on potential customer value. Here, customer relationship management (CRM) systems play a significant role in evaluating customer potential. For example, a software company may prioritize large-scale businesses among new customers. Such companies can use their resources more effectively by focusing on customers who offer high purchasing potential and long-term business relationships. Such a strategy not only evaluates current opportunities but also enables strategic moves to strengthen market position.</p><p>Finally, customer prioritization examples in the service sector are shaped by considering customer feedback and satisfaction levels. For example, a hotel chain can analyze feedback from its guests, prioritize areas that are frequently complained about, and make improvements. This way, the needs of important customer groups are met more quickly, while also increasing overall satisfaction levels. All these examples demonstrate how customer prioritization strategies can be made more efficient through transparent data analysis and targeted service delivery, shedding light on businesses’ efforts to enhance their competitive strength.</p><blockquote><strong>SUCCESS METRICS</strong></blockquote><p>Success metrics play a critical role in evaluating the effectiveness of the criteria used in customer prioritization. Well-defined success metrics are necessary to increase the success of customer segmentation and better align the company’s strategic goals with customer needs. These metrics typically consist of quantitative and qualitative components. Quantitative metrics include <strong>revenue contribution, customer lifetime value (CLV), customer acquisition cost (CAC), and customer loyalty (NPS),</strong> while qualitative metrics include <strong>customer satisfaction, brand loyalty, and experience evaluations.</strong></p><p>One effective way to evaluate success in customer prioritization systems is to establish development indicators over a specific time period. These indicators enable performance to be tracked against defined success criteria and show the extent to which the business is aligned with its strategic goals. For example, a decrease in customer acquisition costs and an increase in sales may be an indicator of improvement in customer segmentation. At the same time, data obtained from customer satisfaction surveys provides important information about how effectively the needs and desires of priority customer segments are being met.</p><p>Success metrics not only evaluate current performance, but also guide the creation of future strategic directions. Regular review of these metrics increases the ability to respond to changing market dynamics. As a result, businesses gain the opportunity to better understand customer needs, optimize resources, and improve the customer experience. In this context, the proper identification of success metrics serves as a critical component of the customer prioritization process, delivering both profitability and sustainable competitive advantage.</p><blockquote><strong>FUTURE TRENDS</strong></blockquote><p>Future customer prioritization criteria will be shaped by rapidly changing economic conditions, technological developments, and changing customer expectations. From an analytical perspective, <strong>the integration of data analytics and artificial intelligence presents</strong> a significant opportunity to better understand and segment customer behavior in the coming years. <strong>Customer data is becoming richer, encompassing not only past shopping habits but also individuals’ social media interactions, online demand, and feedback.</strong> In this context, personalized approaches will come to the fore in customer prioritization processes; the ability to offer personalized recommendations and services to each customer will provide a competitive advantage.</p><p>In addition to technological developments, ethical expectations such as sustainability and social responsibility will also play an increasingly important role in customer prioritization. Customers’ sensitivity to the environmental and social impacts of brands will create new challenges and opportunities for brands. This situation makes it necessary to consider not only economic values but also ethical and social aspects when determining customer prioritization criteria. A company’s ability to respond to these expectations will strengthen its reputation by building long-term customer loyalty.</p><p>Additionally, the development of automated systems and CRM solutions will make customer prioritization processes more efficient. AI-powered tools can analyze customer journeys to provide insights into which criteria are decisive. For example, real-time data streams can quickly identify customer needs and preferences, while also enabling more dynamic strategy development. Ultimately, customer prioritization criteria will be reshaped by the interaction of technology and social values, evolving into a more effective, flexible, and customer-centric approach. Such changes will be critical for both business growth and improving the customer experience.</p><p>You can reach out for support in determining which customers will contribute most to your business and how to efficiently allocate your marketing resources accordingly.</p><p>Stay connected with data.</p><blockquote>Contact</blockquote><blockquote><strong>LinkedIn:</strong> Ender Kaderli</blockquote><blockquote><strong>Email:</strong> enderkaderli@datapaper.ai</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3f23900443eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WHAT DOES INCORRECTLY CREATED DATA ARCHITECTURE COST COMPANIES ?]]></title>
            <link>https://medium.com/@enderkaderli/what-does-incorrectly-created-data-architecture-cost-companies-cc7b1212937a?source=rss-fb5a6dc5b9f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/cc7b1212937a</guid>
            <category><![CDATA[data-architecture]]></category>
            <category><![CDATA[data-governance]]></category>
            <category><![CDATA[data-strategy]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[software-projects]]></category>
            <dc:creator><![CDATA[Ender Kaderli]]></dc:creator>
            <pubDate>Tue, 01 Jul 2025 00:56:33 GMT</pubDate>
            <atom:updated>2025-07-01T00:56:33.637Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>WHAT DOES INCORRECTLY CREATED DATA ARCHITECTURE COST COMPANIES ?</strong></h3><p>The digital transformation of the world presents us with new opportunities and benefits every day. With the rise of artificial intelligence in recent years, data that we used to ignore is now being taken seriously by companies and sometimes turning into decisions and sometimes into money for companies. In other words, the concept of data is currently experiencing a golden age. And all projects within the software world now touch on data in some way, either directly or indirectly. Therefore, creating a data architecture for every project is no longer a choice but a necessity.</p><p>Data architecture forms a critical foundation for structuring an organization’s or a project’s data management processes. A poorly designed data architecture can lead to serious problems in the collection, storage, processing, and analysis of data. Such architectural flaws can result in not only technical difficulties but also strategic, financial, and operational consequences that reduce the efficiency of the organization and the project. As companies face increasing data volume and complexity, the extent to which data can be used effectively has become a determining factor in competitive advantage.</p><p>To understand the importance of data architecture, it is necessary to look at how organizations manage the data lifecycle and how this process is integrated into business objectives. Organizations must manage data as an asset to achieve their strategic goals. Additionally, establishing the right data architecture facilitates the integration of new technologies. Naturally, concepts such as data analytics, big data, and artificial intelligence become more effective with a robust data architecture. Now, let’s examine what this data architecture is.</p><h3><strong>What is Data Architecture?</strong></h3><p>Data architecture is a framework that defines an organization’s strategies for managing, storing, processing, and analyzing data. It defines how data will flow between systems and applications, what format it will be stored in, and what security measures will be used to protect it. Data architecture aims to both increase the efficiency of business processes and optimize data usage. Especially in light of big data, cloud computing, and rapidly changing technological developments, the importance of data architecture has increased exponentially. Even in a simple mobile application, poorly designed data architectures can cause serious problems for companies in the medium and long term.</p><p>Data architecture typically consists of four main components: <strong>data modeling,</strong> <strong>data flow,</strong> <strong>data provisioning,</strong> and <strong>data governance.</strong></p><p><strong>Data modeling</strong> defines the logical and physical structure of data, while <strong>data flow</strong> determines the movement of data between systems and applications. <strong>Data provision</strong> encompasses the processes by which data is collected, stored, and processed; <strong>data governance</strong> includes rules and standards related to data quality, security, and compliance. The combination of these components facilitates the achievement of business objectives by creating an effective data architecture.</p><h3><strong>The Importance of Creating a Proper Data Architecture</strong></h3><p>The importance of creating a proper data architecture stands out as a critical element in ensuring continuity and competitive advantage in the modern business world. With the rapid spread of data-driven decision-making processes, the fundamental elements of data architecture must be clearly defined. An effective data architecture not only ensures the consistency, accessibility, and security of data, but also works in harmony with organizational goals. This structure facilitates data integration, allowing information from different sources to be evaluated as a whole. A proper data architecture makes it easier for companies to achieve their strategic goals, thereby increasing their competitive strength.</p><p>A well-designed data structure promotes collaboration and communication while also increasing transparency and accountability in business processes. This encourages data usage among employees while also enabling managers to make healthier and more reliable decisions through data analytics. A proper architecture also contributes to critical areas such as data security and privacy. Inadequacies in data structuring can increase risks, leading to data breaches, interruptions, and erroneous analyses. Thus, the importance of creating a data architecture is not only decisive in terms of daily operations but also in terms of long-term sustainability.</p><p>An appropriate data architecture enables rapid adaptation to changing market conditions while paving the way for innovative approaches and technological investments. The ability to update the data architecture when necessary to achieve business growth targets is key to remaining competitive.</p><p>In conclusion, establishing a proper data architecture is not merely a technical requirement; it is also an important strategic investment that will shape companies’ future success. This lays an effective foundation for organizations to accelerate their digital transformation processes and create a sustainable business model.</p><h3><strong>So, what are the consequences of poorly designed data architectures?</strong></h3><p>Poorly designed data architectures have many negative effects on companies’ operations, leading to long-term losses. I think it would be more useful to address the potential losses that may arise here in bullet points.</p><blockquote><strong>Loss of Efficiency</strong></blockquote><p>An improperly constructed data architecture is a critical factor that directly affects the operational efficiency of businesses. Deficiencies in data architecture can lead to interruptions in the flow of information within the company, data inconsistencies, and access difficulties. In such cases, employees struggle to access accurate data, decision-making processes are prolonged, and less accurate results are produced. Additionally, unnecessary data processing steps and repetitive tasks not only waste employee time but also negatively impact morale and motivation.</p><blockquote><strong>Failure in Decision-Making Processes</strong></blockquote><p>An improperly structured data architecture can have significant negative effects on a company’s decision-making processes. Without effective data management, it becomes difficult for managers to access accurate information. This situation increases uncertainty and risk factors during the decision-making process. Inconsistencies and gaps in data reduce the effectiveness of the analytical and predictive tools that managers need. In this context, when proper data flow and analysis are not provided, strategic decisions and operational directions lose their validity. Considering the necessity for companies to make effective and quick decisions in a complex market environment, it is quite possible that an improperly constructed data architecture will have more negative effects than expected.</p><blockquote><strong>Increased Costs</strong></blockquote><p>An improperly constructed data architecture contains many factors that can significantly increase a company’s costs. Inconsistencies in data management, information loss, and incorrect data usage directly affect financial performance and lead to increased costs. In particular, analyses based on unreliable data in decision-making processes can mislead businesses. This situation leads to missed opportunities and increased unnecessary expenses. For example, inaccurate data in inventory management can result in products requested by customers not being delivered on time, leading to sales losses.</p><p>In addition, deficiencies in data architecture can increase the infrastructure requirements of the business. Without proper data architecture, the automation of business processes becomes difficult, which increases dependence on human labor and, consequently, raises labor costs. Furthermore, difficulties in consolidating data and executing analytical processes can prevent the timely and effective delivery of targeted analyses and reports. Such delays can increase project costs and have a negative impact on the company’s overall budget.</p><blockquote><strong>Loss of Competitive Advantage</strong></blockquote><p>An improperly structured data architecture contains many fundamental factors that lead to companies losing their competitive advantage. In the modern business world, data analytics and quick access to information are of vital importance for making strategic decisions. However, improperly structured and inconsistent data negatively impacts these analytical processes, leading to misinterpretations and erroneous conclusions. This situation, especially in rapidly changing market conditions, weakens companies’ ability to stay ahead of their competitors. Since the information power companies possess is decisive in predicting market trends and responding to customer demands, deficiencies in data architecture directly threaten their competitive position.</p><p>On the other hand, issues related to data security and privacy are also commonly observed in companies that fail to establish adequate data architecture. Such deficiencies can erode consumer trust while also leading to legal consequences. Companies that fail to comply with legal regulations may face not only financial losses such as revenue declines but also negative impacts on market perception. Ultimately, such vulnerabilities increase the competitive gap with other competitors, which in turn carries the risk of losing market leadership. A robust data architecture not only improves a company’s internal operations but also enhances its resilience against external factors, enabling it to sustain its competitive advantage in the industry.</p><blockquote><strong>Data Breaches</strong></blockquote><p>Data breaches have become an increasingly critical issue in the modern business world. This situation is directly related to the acceleration of digitalization and the collection of large amounts of data by individuals and companies alike. If a company’s data architecture is not properly established, it becomes vulnerable to both internal and external threats. Data breaches cover a wide range of issues, from the theft of personal information to the disclosure of financial data and trade secrets. Such breaches can have profound effects not only on an organization’s reputation but also on financial losses, criminal penalties, and the erosion of customer trust.</p><blockquote><strong>Data Losses</strong></blockquote><p>Data loss is a serious issue that arises when an organization’s data architecture is not properly established. Such data loss is not limited to technical glitches; it can also have profound effects on costs, reputation, and operational efficiency. Especially in large data environments, data loss can result from systemic errors or misconfiguration. For example, failure to automate data backup processes, data deletion, or corruption can lead to loss of access to critical business information. This creates a twofold problem: on the one hand, the value of the lost data, and on the other, the uncertainties arising from this loss have the potential to deeply affect company strategies.</p><blockquote><strong>Low Service Quality</strong></blockquote><p>Service quality is a key factor in determining how well a business meets customer expectations for its products or services. An improperly designed data architecture can negatively impact service quality, leading to decreased customer satisfaction. Data architecture determines how businesses collect, store, and analyze information obtained from customer interactions. If this structure is not sufficiently effective, incomplete or inaccurate data about customer requests, complaints, and feedback may be obtained. As a result, service quality declines, the customer experience deteriorates, and this situation can undermine both customer satisfaction and loyalty.</p><blockquote><strong>Damaged Customer Loyalty</strong></blockquote><p>Customer loyalty plays a critical role in ensuring sustainable growth and success for companies. An inadequate data architecture can create serious obstacles to building this loyalty. Data architecture encompasses the processes of collecting, processing, and analyzing customer interactions and experiences. If companies cannot obtain accurate and up-to-date data on customer interactions, they will face serious difficulties in understanding customer needs and responding to them. Strengthening the bond with customers is only possible with access to accurate data; therefore, a robust database and data analysis systems are necessary.</p><p>As a result, providing a proper data architecture not only increases the efficiency of companies but also enables them to maintain their competitiveness by strengthening their decision-making processes. Organizations can improve data quality, minimize problems, and base their strategic planning on a healthier foundation by adopting a systematic approach to data management. In the future business world, data architecture is not just a technical necessity but also emerges as a strategic asset. In this context, companies should give the necessary importance to data architecture and lay solid foundations for a sustainable and successful future.</p><p>You can reach out for support in creating an effective data architecture.</p><p>Stay connected with data.</p><p><strong>Contact</strong></p><blockquote><strong>LinkedIn:</strong> Ender Kaderli</blockquote><blockquote><strong>Email:</strong> enderkaderli@datapaper.ai</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cc7b1212937a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[WHAT OPPORTUNITIES ARE COMPANIES NOT USING CRM MISSING OUT ON?]]></title>
            <link>https://medium.com/@enderkaderli/what-opportunities-are-companies-not-using-crm-missing-out-on-11ccaef5526f?source=rss-fb5a6dc5b9f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/11ccaef5526f</guid>
            <category><![CDATA[crm]]></category>
            <category><![CDATA[marketing-strategies]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[customer-analytics]]></category>
            <category><![CDATA[sales]]></category>
            <dc:creator><![CDATA[Ender Kaderli]]></dc:creator>
            <pubDate>Fri, 27 Jun 2025 02:18:39 GMT</pubDate>
            <atom:updated>2025-06-27T02:18:39.767Z</atom:updated>
            <content:encoded><![CDATA[<p>With the daily increase in the amount of data we can collect and analyze about our customers and its transformation into strategy, the business world has begun to understand the importance of CRM (Customer Relationship Management) on a sectoral basis. From reminders about products we added to our cart but didn’t purchase on an e-commerce site to promotional messages from a telecommunications operator that suddenly appear on our mobile phones, many things have become more achievable and sustainable for companies through CRM applications. Of course, even though we are discussing the topic under the name of CRM, we must not forget that CRM applications are actually a culture and ecosystem in the background.</p><p>Of course, this ecosystem has parts, each part has separate tasks, and there are many techniques and algorithms used within these tasks. The details of these will not be discussed in this article, but they will be mentioned briefly in some places.</p><p>However, I believe it is important to briefly discuss the types of CRM. <strong>Operational CRM</strong>, which automates sales, marketing, and service processes. <strong>Analytical CRM</strong>, which analyzes data to provide customer insights. <strong>Collaborative CRM</strong>, which facilitates information sharing between departments such as sales, support, and marketing. And finally, <strong>Strategic CRM</strong>, which influences customer-focused long-term decision-making processes.</p><p>In fact, CRM types alone provide us with a good idea of the real benefits of this ecosystem. They can also offer insights into the cash, effort, and potential customer resources that properly designed and implemented CRM infrastructures can generate. Now, let’s examine the potential losses of not adopting CRM systems in light of this information.</p><p>Companies that do not adopt CRM systems are likely to face many serious problems. The most obvious of these challenges is <strong>weakness in customer relationship management.</strong> While customer satisfaction and loyalty are of vital importance in today’s business world, CRM software offers one of the most effective tools for managing and strengthening these relationships. The absence of CRM increases the risk of companies being unable to analyze customer feedback in a timely manner, fully understand their needs, and thus fail to build a loyal customer base. Weak customer relationships can lead to missed sales opportunities, as well as more significant issues such as customer loss and damage to reputation. As a result, companies that do not adopt a customer-centric approach see their competitive strength diminish and their market position become questionable.</p><p>Another issue is <strong>data loss and fragmentation</strong>. CRM systems store customer data in a centralized repository, ensuring that this information is organized, accessible, and analyzable. Organizations that do not use CRM often store customer information in a fragmented manner across various departments, exposing them to the risk of data loss and inconsistency. This situation leads to decisions based on incorrect information and a lack of valuable insights. As a result, a company’s performance and strategic decision-making process are negatively impacted; a company that cannot capitalize on market opportunities, or even one that is misguided, creates uncertainty in the minds of customers and falls behind in the competition.</p><p>On the other hand, companies that do not use a CRM system also face <strong>the risk of overlooking sales opportunities</strong>. Often, customer requests and sales data are ignored, resulting in the loss of potential revenue sources. CRM technology enables companies to approach customers more effectively by automating and analyzing sales processes. Without it, sales teams struggle to achieve the necessary efficiency and success in performing their duties, and lost opportunities become irreplaceable. The absence of CRM not only weakens existing customer relationships but also leads to significant losses in acquiring new markets and customers. Such issues pose serious threats to <strong>a company’s long-term sustainability, making change inevitable</strong>.</p><h3><strong>SUMMARY</strong></h3><p>In the last part of this article, I think it would be useful to discuss the technical components of this ecosystem and their place in the system. This is because the losses that will occur when the components of the ecosystem are not properly positioned will not be much different from the losses of companies that do not use this system.</p><p>In this section, <strong>CRM developers</strong> are the people who feed data into the system and integrate the software. <strong>Data scientists or data analysts</strong> working in the system are the elements that process data and reveal invisible patterns with models, from customer segmentation to churn analysis, from RFM techniques to cohort analysis. <strong>BI experts</strong> play a role in reporting the data generated in the CRM infrastructure and visualizing managerial outputs. The final link in the technical chain is usually <strong>machine learning engineers</strong>, who make predictions using advanced analytical models and implement them into the system. The proper positioning of this structure directly affects the sales and marketing strategy decisions made by the CRM Manager at the next level up, and is a critical condition for the efficient use of the system.</p><p>In other words, investing in CRM software alone is not a solution, and failure to properly structure the system can lead to inefficient use of resources and cause your customers to drift away from you over time, reducing your competitive strength in the market.</p><p>You can contact us for support regarding the technical and managerial processes of CRM systems.</p><p>Stay connected with data.</p><p>Contact</p><p><strong>LinkedIn</strong>: Ender Kaderli</p><p><strong>Email :</strong> enderkaderli@datapaper.ai</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11ccaef5526f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DATA RETENTION STRATEGIES]]></title>
            <link>https://medium.com/@enderkaderli/data-retention-strategies-9dace3a3ae08?source=rss-fb5a6dc5b9f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/9dace3a3ae08</guid>
            <category><![CDATA[data-analytics]]></category>
            <category><![CDATA[business-intelligence]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[big-data]]></category>
            <category><![CDATA[data]]></category>
            <dc:creator><![CDATA[Ender Kaderli]]></dc:creator>
            <pubDate>Mon, 23 Jun 2025 23:37:41 GMT</pubDate>
            <atom:updated>2025-06-23T23:37:41.742Z</atom:updated>
            <content:encoded><![CDATA[<p>In the digitalization journey of the world, the data size journey that we started with bits continues to be named with data size concepts such as gigabyte, terabyte and even petabyte, exabyte, zettabyte, yottabyte, which we have never heard of. We will probably hear different concepts for larger ones in the coming years. Of course, in addition to the increase in these sizes, our data sources are diversifying day by day. From the smartwatch on our wrists to the security camera of a shopping center we enter, a lot of data is collected from many different environments that we are aware of but not aware of. And this chain will continue to grow within the Internet of Things... Of course, the data we systematically collect from our customers or from some open sources on the internet is also a link in this chain.</p><p>On the other hand, companies have also benefited from this digitalization, and there have been companies that have made serious breakthroughs in decision-making in this data pool that reaches them through both the data they keep about their customers and digital objects, and the number of companies that understand the power of this data is increasing day by day.</p><p>Of course, in parallel with the increase in our data sources, some problems started to emerge and the importance of collecting data with an effective strategy started to increase as ecosystems grew. Of course, this situation has brought different questions to our minds and turned into an obligation to move forward with new approaches at this point. While there are many questions on this topic, a few more issues are often at the forefront of decision-makers&#39; minds at the point of data collection.</p><p>First of all, yes, we are collecting this much data, but which data is essential for our project and how can we store really usable data in the right way and save our systems from unnecessary burden while saving us from increasing storage costs and converting this data into money for our company in line with our strategies?</p><p>This is where data retention strategies for companies come into play. Although sectors and companies have their own different dynamics, there are some issues that every company should pay attention to when determining the strategy on this issue. Let&#39;s look at these now. Of course, the order of the items I have mentioned here may change according to the project and the company, but in general terms, it is possible to address these issues under the following headings.</p><ul><li><strong><em>Necessity</em></strong></li><li><strong><em>Security</em></strong></li><li><strong><em>Standardization</em></strong></li><li><strong><em>Sustainability</em></strong></li><li><strong><em>Quality</em></strong></li><li><strong><em>Usability and Integration</em></strong></li></ul><blockquote><strong>NECESSITY</strong></blockquote><p>The first question is, do we really need this data for our projects?</p><p>As I mentioned at the beginning of the article, the resources we can now collect data are moving towards the point of being unlimited. However, just as our storage areas cannot grow at the same percentage, the system resources we develop do not grow at the same rate at the point of processing data, or companies may delay investing in systems at the point of profitability. At this point, there are some decisions that need to be taken.</p><p>First of all, project needs need to be clearly defined. The variety of data required for a data science project may not require the same depth of data for a mobile application project to be developed from b2b. Therefore, for each project, companies need to think &quot;Yes. This is the data I need&quot; rather than &quot;Will I need this data one day? This is the data I need. And I can keep this data within my project budget.&quot; It is important that they adopt the understanding. Of course, since projects may lead to other projects and needs over time, it is equally necessary to establish flexible and scalable structures. Project managers and business analysts have important roles to play here. In summary, a good analysis of the needs is the most necessary condition.</p><p>In the opposite scenario, it is very likely that your company will face a lot of idle data that no one knows why it is there, as well as idle capacity, labor and cost issues.</p><blockquote><strong>SAFETY</strong></blockquote><p>At the next stage, we store this data, but it is important to look for answers to the questions of whether our data comes from secure sources and can we ensure the security of the data we hold?</p><p>Our data source is very small, our data capacity and system is small. Okay, we have clearly determined the data we need, and we have created a flexible and scalable architecture considering the projects that may arise in the future. So at what level can we ensure the security of the data we keep? And do we store the data where it should be?</p><p>Data security has become an important issue for the whole world in recent years and companies are sometimes subject to serious sanctions for failing to protect some of the data they provide from their users. The dose of cyber-attacks is increasing day by day and the issue of data security is becoming even more important. On the other hand, companies working with different countries in terms of the security of the data kept here need to simultaneously follow not only the data security protocols in their own countries but also the protocols of the countries where their users are located. And when necessary, they may have to keep their data in other countries. Although cloud solutions and data centers make this relatively easier, they may not always offer a 100% solution. Since this part now falls under data law, legal support is very important as well as database administrators.</p><p>Two questions arise here. How secure are the data sources we will use and how secure are the places where we will save this data?</p><p>Yes, we want to transfer the data we need from a source that we think is reliable to the database we use and shape our project with such a structure. Well, have we ever thought about the possibility that the data source used could create a vulnerability in our system or generate incorrect data?</p><p>This is a serious problem and one that really needs to be thought about. If it is not secure, that data is never yours. This is where the importance of cyber security experts comes into play. On the other hand, database administrators and data engineers also have a lot of work to do in securely retrieving the data from the source and protecting it from attacks. As I said, no unsecured data belongs to you. And data that is thought to be cheap today may cost you serious costs in the future.</p><blockquote><strong>STANDARDIZATION</strong></blockquote><p>We have identified the data required for our project and securely stored it. So, does our data have a standardization to talk to the modules within our project and the customer?</p><p>This is one of the problems faced by companies working with data in recent years. We talked about the abundance of data sources. But every data source you consult outside the company may have a data architecture created as a result of its own dynamics. So, can we use the data we get from so many sources as it is? I seem to hear you wish, but this is not possible. In fact, it is almost never possible.</p><p>This is where data engineering and data architecture come into play. Even if the project manager and business analysts determine the needs in the structure to be established, it is very valuable to make data from different sources available to other developers involved in the project with the least effort. Otherwise, it should not be forgotten that your development team will exert more effort to work with this data, which may lead the project to dead ends in terms of both time and budget. In summary, the data kept should speak the same language as much as possible. And all developers working with the same data should be able to understand the same things from that data.</p><blockquote><strong>SUSTAINABILITY</strong><br>The next issue in data retention strategies is sustainability. This is the unknown gateway to unlimited data sources. But there are always safe harbors.</blockquote><p>Of course, there are two dimensions to the issue.</p><p>First of all, while the dynamic data we keep will grow day by day, will we be able to keep up with this growth? We started the project with a 10 gigabyte space, but what is our plan B when our disk starts to fill up before a few months have passed? Will we move this data to another disk? Or will we enlarge this space by paying a little more for the data we keep on the cloud? Or will we produce another solution? It should not be forgotten that all 3 options should be considered according to the project. The decisions to be made here are facts that decision makers should definitely not ignore in terms of time, cost and effort.</p><p>But what about the reliability of our data source? I have already touched on the cyber-attack and legal aspects of security, but here we also need to ask the following questions. How long will I be able to access the data source we use? In other words, tomorrow the data sharing policies of the source from which you get your data may change and you may have to pay a fee to get data from that source, or you may not get any data at all and you may have to turn to other sources. At this point, choosing a well-established and well-established data source can save you a lot of potential costs in the future. Data analysts also have a role to play here.</p><blockquote><strong>QUALITY</strong></blockquote><p>Under the heading of standardization, I mentioned the importance of data sources where data can be transformed into a form that can be used by all stakeholders with the least effort. So how does data quality appear here?</p><p>There is a situation that is important. There may be incorrect data in the data we receive from different sources or there may be some inconsistencies in the templates of the data. Yes, the source from which you get the data is the same, but no correction has been applied for the data coming from the source, or this has been done partially, and you need extra effort to constantly check and work on the data, apart from your standardization stages.</p><p>To give a simple example; let&#39;s say you wanted to use air temperatures from a source in your data project. Yes, the data flows every day to the source from which you get the data, and you directly transfer this data to your own database and advance your project from there. You never questioned the data quality of the source and you wanted to use it as it is...</p><p>This is where you may need to be ready for some surprises.</p><p>There may be missing numerical data, incorrect entries, or one part of the data may be entered in one numerical type while another part is entered in another data type. Of course, until you realize these and integrate them into your own system, the time that will pass in between, or even the incorrect design of your system in places, may require you to bear some additional costs. Remember, sometimes even the spaces next to the row values in a simple excel table can be overlooked and we have problems until we find them. Or working with clean data by constantly extracting outlier values can be a waste of time.</p><blockquote><strong>COMPATIBILITY AND INTEGRATION</strong></blockquote><p>Finally, the compatibility of the data we will use with the technologies we use is also an important parameter in terms of data storage strategies. Yes, data may be available in an external source and it may be there under the conditions we want. However, some of the software solutions required to process this data are not available in our company, or even if they are available, the potential time and labor costs that may arise at the point of adaptation to our system are among the points to be considered.</p><p>At this point, the use of resources that can be more easily integrated with the technologies used by your company may be an important reason for preference. Here, it is important to make effective cost-oriented and strategic decisions from time to time for the salvation of the project. Because changing the technology used in the middle of projects is not a situation that developers would prefer. It is also possible that adapting to the new technology may cause some potential additional costs in terms of time, effort and budget.</p><p>In addition, the ability of the staff to quickly adapt to the existing ecosystem after the departure of the developer working on the project is also an issue that should be considered under this heading.</p><p>At the end of the day, there is always the possibility that the data we cannot collect with certain strategies will lead us to unknowns in terms of budget, time and effort for our project, although the order of these headings will vary according to the companies.</p><p><strong>For this reason, while creating our projects, regardless of the scale of the project, whether we are a freelancer or the IT department manager of an international company, the above-mentioned issues will be the issues that we all need to question and act with strategic planning in terms of proper management of both labor, system resources and budget.</strong></p><p>You can contact us to determine the data strategies for your projects and to help you use your data efficiently within your projects.</p><p>Contact</p><p>Linkedin : Ender Kaderli</p><p>E-Mail : enderkaderli@datapaper.ai</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9dace3a3ae08" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ADIM ADIM NOSQL VE MONGODB-6 : DİZİ TİPİ VERİLER VE JOIN İŞLEMLERİ]]></title>
            <link>https://medium.com/@enderkaderli/adim-adim-nosql-ve-mongodb-6-di%CC%87zi%CC%87-ti%CC%87pi%CC%87-veri%CC%87ler-ve-join-i%CC%87%C5%9Flemleri%CC%87-61c3c9f1415c?source=rss-fb5a6dc5b9f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/61c3c9f1415c</guid>
            <category><![CDATA[array-functions]]></category>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[join]]></category>
            <dc:creator><![CDATA[Ender Kaderli]]></dc:creator>
            <pubDate>Mon, 18 Mar 2024 04:05:30 GMT</pubDate>
            <atom:updated>2024-03-18T04:05:30.440Z</atom:updated>
            <content:encoded><![CDATA[<h3>ADIM ADIM NOSQL VE MONGODB-6 : DİZİ TİPİ VERİLER VE JOIN İŞLEMLERİ</h3><p>MongoDB yazı dizimin 5.yazısında index ve text search işlemlerinden bahsetmiştim. Yazıya <a href="https://medium.com/@enderkaderli/adim-adim-nosql-ve-mongodb-5-index-ve-text-search-i%CC%87%C5%9Flemleri%CC%87-81ca2320de5c">linkten</a> ulaşabilirsiniz. Dizinin son yazısında ise dizi tipi verilerle yapılan bazı işlemlere ve her ne kadar ilişkisel veri tabanları gibi olmasa da MongoDB’nin join yorumuna bir göz atacağım.</p><p>Öncelikle dizi tipi veriyi tanımlayarak başlangıç yapalım. Şu zamana kadar üzerinde çalıştığımız verilerde her alan altında tek veri bulundurduğumuz ulkebilgi collectionındaki belgeler vardı ve buradan basit şekilde verilerimize ulaşabiliyorduk. Aslında ilişkisel veri tabanlarındaki tablo düzenindeki satır ve sütunların sanal bir şekilde işlenmesi gibiydi yaptığımız işlemler.</p><p>Peki ya belgelerdeki alanlarımız içerisinde birden fazla değer ya da alan varsa ? İşte bu tip verileri kabaca dizi tipi veriler olarak tanımlıyoruz. En kaba hatlarıyla dizi tipi verinin tanımına bunu yazabilirim.</p><p>Dizi tipi veriler aslında başta sosyal medya olmak üzere pek çok yerde karşımıza çıkmakta ve bunları işleyebilmek içinse MongoDB’nin bize sunduğu pek çok şey mevcut.</p><p>Bu arada burada dizi tipi verilerdeki sorgulamalar için kullanacağımız operatörlere girmeden önce şunu hatırlatmam gerekmekte. Dizi tipi verilerde de daha evvel işlediğimiz operatörler ve işlevler kullanılabilmekte. O sebeple tek tek burada tüm operatörlere değinmeyeceğim. Öte yandan ulke veri tabanımızdaki ulkebilgi collectionımız dizi tipi veriler içermediği için dizi işlemleri için yeni bir veri tabanı ve collection oluşturacağım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RFuoS64qtsvBMbf3Gs5n-Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*g3pX9F7N4H6ANMa2luXMZQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*v62AYtriT4y3lT1-oKRGbw.jpeg" /><figcaption><strong>DB, Collection ve Belgelerin Oluşturulması</strong></figcaption></figure><p>db.xyz.find() ile oluşturduğumuz bu yeni belgeleri görebilirsiniz.</p><p>O zaman vakit kaybetmeden ilk operatörümüz olan <strong>$all </strong>ile<strong> </strong>başlayalım. Bu operatör bize aradığımız elemanların dizi içerisinde olup olmadığını göstermek için kullanılır. Aslında find() işlevine benziyor olsa da arada şöyle bir fark vardır. find() tüm belirli değerlere sahip belgeleri değil, dizi içinde herhangi bir değeri içeren belgeleri getirirken, $all operatörü belirtilen tüm değerlere sahip belgeleri getirir. O zaman hemen bir örnek yapalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*3P2Si6jc-KzdyP-fPX5akA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/1*aHJECNbQUfiuhfhYiDtV9w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/490/1*GMcDJp9A3hdzj_aXeYLz5A.jpeg" /><figcaption><strong>$all Kullanımı</strong></figcaption></figure><p>Görsellerde görüldüğü üzere tags alanı içerisindeki “appliance” , “school” ve “book” alanlarını içeren diziler çıktı olarak geldiler.</p><p>$all operatörünü anlattıktan sonra bir sonraki operatörümüz olan <strong>$elemMatch </strong>operatörüne geçelim. Bu operatörü daha çok dizi içerisinde aradığımız ya da karşılaştırma yapacağımız veri tipinin sadece string ya da integer tarzı bir veri olmasından ziyade bunların kombini object tipi bir veri olduğu durumlarda daha çok kullanırız. Yani birden fazla koşulu içeren belgeler için dizilerde kullanışlıdır. Fakat en önemli verilmesi gereken detay şudur. Dizi içerisinde verdiğiniz koşul sağlanıyorsa diğer koşullara bakılmaksızın o dizinin tamamı sorgu sonrası gelecektir. Şimdi qty alanı içerisinde size bilgisi M ve num alanı 50 den büyük olan değerler için bir $elemMatch sorgusu yazıp çıktıyı inceleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/688/1*QRi5Sekr3Hjz-d6yI_aELA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*Au3H9GNPl4MqiDtVpG5Abg.jpeg" /><figcaption><strong>$elemMatch Kullanımı</strong></figcaption></figure><p>Şimdi sorgumuzu yazarken size için M ve num alanı için 50 den büyük değerlerin geçtiği dizileri yakala demiştik $elemMatch e. Ama görsellere baktığımızda size için L ve S değerlerini de getirmiş ve S alanı için num değeri 10. İşte bir önceki kısımda anlatmak istediğim tam olarak buydu. $elemMatch çalışma mantığı itibariyle dizide yakaladığı bir alan varsa o dizinin tamamını getirir. code alanı efg olan belgemizdeki qty dizisinde normalde hem size bilgisi M olan hem de num değeri 100 olan tek bir kayıt vardı. Fakat aynı dizi içerisinde bulunduğu için diğer alanlar da karşımıza gelmiş oldu.</p><p>Bir sonraki operatörümüz olan <strong>$size</strong> operatörü ise belge içerisinde bulunan dizi tipindeki alanın boyutunu kontrol eder.</p><p>Şöyle bir örneğimiz olsun. Elimizdeki dizide tags alanı 5 olan belgeleri görmek isteyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*fhs38M4ZEAVvCo29SOY7NQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*IOhXY1LDhDiNx0A42RLOvA.jpeg" /><figcaption><strong>$size Kullanımı</strong></figcaption></figure><p>Dizi içerisinde sorgulamalarla alakalı olan operatörleri inceledik. Peki ya bu dizilerde değişiklikler yapmak istersek ? İşte burada <strong>$push</strong> ve <strong>$addToSet</strong> operatörleri ve bunların içinde parametre olarak kullandığımız <strong>$each , $slice , $sort ve $position</strong> operatörlerine değineceğiz.</p><p>$push operatörü dizi içerisine veri eklemek için kullandığımız operatörümüzdür. Yanına parametre olarak belirtmiş olduğumuz yardımcı operatörleri alabilir. Şimdi $push ve yardımcı operatörlerin kullanımlarına bakalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pygq1drjVcozALjS1SgPEg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*21iOkkoEN6V0nw6iivZnJw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*4MbaP_wqmmTs0aVxRJbeIA.jpeg" /><figcaption><strong>$push ve Yardımcı Operatörlerin Kullanımları</strong></figcaption></figure><p>$push diziye tek bir veri eklemek için kullanılır ve ilk görselde belirttiğimiz id li belgenin tags alanına pencil değerini ekledik. Yardımcı operatörleri tek tek anlatıp daha da yazıyı uzatmamak adına aşağıdaki tablo içerisinde nasıl ve neden kullanıldıklarını gösterdim. Operatörlerin etkilerini find() sorgusu yazarak test edebilirsiniz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*7aUekj5pd3Vle8UnBW5kQQ.png" /><figcaption><strong>Yardımcı Operatörler ve Kullanımları</strong></figcaption></figure><p>$addToSet e geçmeden önce belirtmem gerekiyor ki bu yardımcı operatörlerin tamamı $push içerisinde kullanılabilirken $addToSet için sadece $each operatörünü içeriye parametre olarak alabilmekteyiz.</p><p><strong>$addToSet </strong>operatörü aslında $push ile yaptığımız veri ekleme işlemini yapar fakat burada önemli bir fark vardır. $push ile güncelleme yaparken diziye eklenen veri ya da alanların mükerrer olup olmadıkları önemli değildir. Fakat $addToSet bu mükerrerliği kabul etmez ve eğer eklemek istediğimiz alanlar ya da veriler dizimizde mevcutsa bunları tekrar eklemeyecektir. Şimdi $addToSet örneklerine bakalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*U6UNkw-_yXt0DsjASElh3g.png" /><figcaption><strong>$addToSet Kullanımı</strong></figcaption></figure><p>İlk sorgumuzda tags içerisine car alanını ekledik. $each kullandığımız 2.örnekte ise bus, car ve pen ekledik fakat 2.sorguyu çalıştırdıktan sonra find() ile collectionı kontrol ettiğinizde car alanının tekrar eklenmediğini göreceksiniz.</p><p>Dizi verilerde sorgulama ve update için kullandığımız işlevleri tamamladığımıza göre index işlemlerini anlattığım bir önceki yazımda bahsettiğim ve dizi tipi verilerde kullandığımız text index tipi olan <strong>“2dsphere” </strong>parametresine kısaca değinmek istiyorum. Daha çok coğrafi verilerin indekslenmesinde karşımıza çıkan bu parametreyi daha iyi örnekleyebilmek için xyz collectionımıza yeni veriler ekleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*grsftDPcDAjzoONlpIIcmA.png" /><figcaption><strong>Koordinat Alanlarının Eklenmesi</strong></figcaption></figure><p>xyz collectionında bulunan diğer belgelerimizle karışmaması için diğer belgelerimizin içerisine bir alan olarak bu değerleri eklemek yerine ayrı belgeler olarak ekleme yaptım. Şimdi coordinates alanımızı indeksleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*cMw6y3aA9wMcNF3a0II2JQ.png" /><figcaption><strong>2dsphere Index Kullanımı</strong></figcaption></figure><p>createIndex() işlevi içerisinde coordinates alanımızı indexlerken getIndexes() işlevi ile de o collection üzerinde tanımlı tüm indexlerin listesine ulaşabiliriz. Bir önceki yazımda tanımladığım indexler de listede görünmekte.</p><p>Dizi ile alakalı tüm işlemlerimizi tamamladığımıza göre yazının diğer konusu olan join işlemlerine devam edebiliriz.</p><p>Başlığa join işlemleri yazdım ama ilişkisel veri tabanlarında olan join işlemimiz gibi tablo birleşimleri aklınıza gelmesin. Burada iki belgeyi belirli referans alanı kullanarak birleştirme işlemine MongoDB yorumuyla join diyelim biz. Bunun için ihtiyacımız olan operatörler <strong>$lookup</strong> ve <strong>$aggregate. </strong>$aggregate operatörünü ve kullanımını bir önceki dizinin 4.yazısında işlemiştim detaylara <a href="https://medium.com/@enderkaderli/adim-adim-nosql-ve-mongodb-4-aggregate-i%CC%87%C5%9Flemleri%CC%87-4ecf3a6c08a9">linkten</a> ulaşabilirsiniz.</p><p>O zaman daha fazla vakit kaybetmeden referans alan içeren 2 ayrı belge oluşturup örneğimizi yapalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*U1ZiBRC3uQUPb-Dt1X0iBQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*bS7UjPA9QvYiq7wHtzN7lA.jpeg" /><figcaption><strong>Join Veri Tabanı ve Join1 İle 2 Collectionlarının Oluşturulması</strong></figcaption></figure><p>$aggregate ile birlikte kullanacağımız $lookup sorgumuzun ekran görüntüsünü atmadan önce kodun yapısını inceleyelim.</p><pre>db.join1.aggregate([<br>  {<br>    $lookup: {<br>      from: &quot;join2&quot;,<br>      localField: &quot;product_id&quot;,<br>      foreignField: &quot;_id&quot;,<br>      as: &quot;product_info&quot;<br>    }<br>  }<br>])</pre><p>$lookup operatöründe ihtiyacımız olan parametrelerden <strong>from </strong>parametresine birleştirmek istediğimiz collectionımızın(yani 2.collectionımızın) adını , <strong>localField </strong>parametresine ilk collectionımızın birleştirmek istediğimiz alanını , <strong>foreignField </strong>parametresine 2.collectionımız ile ilk collection arasında bağ kurmasını istediğimiz alan adını ve son olarak ise <strong>as </strong>parametresine ise bu birleşme işleminden sonraki oluşacak alanın adını giriyoruz. Hepsi bu kadar. Şimdi isterseniz yukarıdaki kodun çalışmış halinin verdiği çıktıyı görelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*wfCVUdu6Ojvf-8IK2InQqg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*pUm0IwIPGRhU0D73MBOglg.jpeg" /><figcaption><strong>$lookup İle Join Yapısı</strong></figcaption></figure><p>Çıktı sonucuna baktığımızda ilk collectionda bulunan anahtarla keşisen tüm belgeler ile as parametresiyle oluşturduğumuz alan içerisinde 2.collectionımızda kesişen alanlar birleşerek gelmişler. Join işlemlerini de tamamladığımıza göre yavaş yavaş diziyi sonlandıralım.</p><p>Dizinin son yazısını tamamlarken öncelikle diziyi takip eden tüm herkese teşekkür ederim. Birilerine bir faydamız dokunabildiyse ne mutlu. Öte yandan eklemek istediğim birkaç şey var. Öncelikle ilk kez dizi halinde bir şeyler paylaşmaya çalıştım. Muhakkak kusurlarım olmuştur. Bu noktada dikkatinizi çeken noktalar olursa geri bildirimleriniz gerçekten benim için önemli olacaktır. <a href="https://www.linkedin.com/in/enderkaderli/">Linkedin</a> hesabım üzerinden bana ulaşabilirsiniz.</p><p>Öte yandan bir başka nokta ise ; ilk yazımda belirttiğim üzere aslında MongoDB üzerinde çalışırken aldığım notların tabiri caizse temize çekilmesiyle bu diziyi MongoDB için başlangıç yapmak isteyen kullanıcılara bir kılavuz olması mahiyetiyle hazırlamış oldum. Dolayısıyla aslında benim yaptığım şey MongoDB’ye yeni başlayan ya da başlama niyetinde olan arkadaşlarım için bu dünyada bir pencere açmaktı. Ama üzerine gittikçe MongoDB’nin sınırlarının buradaki 6 yazı ile sınırlı kalmayacağını bu alanda çalışmak isteyen arkadaşlar için belirtmek isterim.</p><p>Son olaraksa bu yazıya ait kodlara <a href="https://github.com/laerrof/MongoDBTutorial/tree/main">github</a> hesabımdan ulaşabilirsiniz.</p><p><strong>İletişim</strong></p><p><strong>Linkedin : Ender Kaderli</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61c3c9f1415c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ADIM ADIM NOSQL VE MONGODB-5 : INDEX VE TEXT SEARCH İŞLEMLERİ]]></title>
            <link>https://medium.com/@enderkaderli/adim-adim-nosql-ve-mongodb-5-index-ve-text-search-i%CC%87%C5%9Flemleri%CC%87-81ca2320de5c?source=rss-fb5a6dc5b9f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/81ca2320de5c</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[indexing]]></category>
            <category><![CDATA[text-search]]></category>
            <dc:creator><![CDATA[Ender Kaderli]]></dc:creator>
            <pubDate>Thu, 07 Mar 2024 00:20:33 GMT</pubDate>
            <atom:updated>2024-03-07T00:20:33.891Z</atom:updated>
            <content:encoded><![CDATA[<h3>ADIM ADIM NOSQL VE MONGODB-5 : INDEX VE TEXT SEARCH İŞLEMLERİ</h3><p>Bir önceki yazımda aggregate(kümeleme) işlemlerinden bahsetmiştim. Yazıya <a href="https://medium.com/@enderkaderli/adim-adim-nosql-ve-mongodb-4-aggregate-i%CC%87%C5%9Flemleri%CC%87-4ecf3a6c08a9">linkten</a> ulaşabilirsiniz.</p><p>Dizinin 5.yazısında MongoDB’de yine fazlasıyla karşımıza çıkan index yapıları ve text search işlemlerine değineceğim. Fakat öncelikle indexin ne olduğu ve veri tabanı sistemleri içerisinde bize ne gibi faydalar sağlayabileceğine bir göz atalım.</p><p>Indexler gerek ilişkisel gerekse de ilişkisel olmayan veri tabanlarında sorgu performanslarını arttırmamıza yarayan yardımcı araçlardır. Eğer bir collection ya da tablo için indexler oluşturulmadığında orada yapacağımız sorgulamalar olsun filtrelemeler olsun ya da başka tip işlemler olsun hep tüm data üzerinde çalışarak bize işlemimizin sonucunu getirmeye çalışacaktır. Bu da veri boyutları büyüdükçe index olmayan collection ya da tablolar için daha uzun sorgulama süreleri, sistem kaynaklarının ise verimsiz kullanımı gibi durumlarla bizi baş başa bırakacaktır. Kafanızda biraz daha somutlaşması anlamında örneklendirmek gerekirse kitap indexleri benzeri bir çalışma mantığından söz edebiliriz.</p><p>Peki MongoDB için indexlerden bahsederken sadece tek tip bir index yapısından bahsetmemiz mümkün müdür ? Tabii ki de hayır. Bu noktada yazı içerisinde farklı kullanımları olan 3 ayrı index tipine değineceğim. Bunlar; unique, compund field ve text tipi indexlerdir.</p><p>O zaman daha fazla vakit kaybetmeden <strong>unique index </strong>kavramına değinelim.</p><p>ulkebilgi collectionımız içerisindeki _id alanımızı gözünüzün önüne getirmenizi istiyorum. Bu değer ben herhangi bir index tanımlaması yapmadığım için MongoDB tarafından otomatik olarak belgeye atanmış ve her belge için ise birbirlerinden farklı olarak atanmıştı. Aslında burada MongoDB otomatik olarak siz aksini istemedikçe bir index ataması yapmış oluyor. Tabii tüm _id değerleri birbirlerinden farklı olduğu için aslında MongoDB burada unique index kullanmış oluyor. Ve artık bu alanı referans alarak yapacağımız filtreleme ve sıralama işlemlerinde MongoDB bu indexi baz alarak işlem yapacaktır. Peki “Ad” kolonumuz için unique index oluşturmak istersek ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/378/1*LmaqGTlyndIWA_McsVKeGQ.png" /><figcaption><strong>Unique Index Kullanımı</strong></figcaption></figure><p>Burada dikkat edilmesi gereken nokta Ad kolonunu indexe alırken azalan sıralama kullandım. Artan sıralama ile de bunu yapabilirim. Öte yandan kodun 2.kısmındaki <strong>unique:true</strong> ifadesi de aynı şekilde dikkat edilmesi gereken bir diğer nokta.</p><p>Peki ya birden fazla alanımız için indexe ihtiyaç duyarsak; işte burada imdadımıza <strong>compund field index</strong> yetişiyor. Bu sefer kıta alanımı artan ve yıl alanımı ise azalan şekilde sıralayarak indexliyorum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*iuDdR957kywc27z_uGDOKQ.png" /><figcaption><strong>Compund Field Index Kullanımı</strong></figcaption></figure><p>Son olarak indexleme için ihtiyacımız olan şey alan adı yerine belge içerisindeki verilerle ilgili ise bu işlem için <strong>text indexe </strong>ihtiyaç<strong> </strong>duyacağız. Aslında text indexler için bir çeşit arama motoru da diyebiliriz. Öte yandan text indexler içerisinde parametre olarak tanımlayabileceğimiz 3 farklı ifade bulunmakta. Bunlar, <strong>“text”</strong> , <strong>“hashed”</strong> ve <strong>“2dsphere”</strong>. Bu yazıda text ve hashed ifadelerine değineceğim. 2dsphere ise dizi tipi verilerde kullanıldığı için bir sonraki yazımda bahsedeceğim ondan. Farklı text index yapıları için birkaç örnek yapalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*cEeCbuHPTZ9bIqkWSrYRuA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/376/1*kJUiffMEOMpc_5X_PTYvag.jpeg" /><figcaption><strong>Text Index Kullanımları</strong></figcaption></figure><p>Birden fazla alana text indexi uygulayabileceğimiz gibi tek bir alan için de bunu yapmamız mümkün. Öte yandan görsellerde de gördüğünüz üzere hashed parametresi number tipindeki veriler için text ise string ifadeler için kullanılmakta.</p><p>Şimdi de indexlerden sonra yazının diğer konusu olan text search işlemlerine bakalım.</p><p>Veri tabanlarında işlem yaparken zaman zaman alanlar içerisindeki verilere gerek kelime kelime gerekse de başka ifadelerle ulaşmak isteriz. Örneğin ulkebilgi collectionımızı gözümüzde canlandıralım. Bizim collectionımızda 5 adet belge mevcuttu. Fakat gelin bu sayıyı 200 yapalım ve bu 200 belge içerisinde istediğimiz herhangi bir kıtaya ait a harfi ile başlayan ülkeleri görelim. 5 adet belge için böyle bir senaryoda hiçbir işlem yapmadan hızlıca sonuca ulaşmamız mümkün. Fakat data büyüdüğünde text search işlemleri bizim için fazlasıyla gerekli bir ihtiyaç halini almakta. Ayrıca bir sonraki yazıda işleyeceğim dizi tipi verilerde de benzer ihtiyaçlar fazlasıyla karşımıza çıkacak.</p><p>Umarım text search ifadesinin bizim için ne işe yarayacağını anlatabilmişimdir. Şimdi farklı senaryolardaki örneklere geçelim. Bu örnekleri yaparken <strong>$text</strong> ve <strong>$search</strong> operatörlerine ihtiyacımız olacak.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*uZ6CHpbbxDOxDWBNoqCMWg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*ir8LorSctTM0liML65n0hA.jpeg" /><figcaption><strong>Farklı Text Search Kullanımları</strong></figcaption></figure><p>İlk örneğimizde içerisinde Almanya geçen belgeleri görmek istedik. 2.örnek ise birden fazla kelime için kullandığımız text search metoduna ait. Burada dikkat edilmesi gereken nokta ise arayacağımız kelimelerin arasına sadece boşluk bırakıyor olmamız. Sorgumuz bize hem içinde Endonezya geçen hem de Asya geçen kayıtları getirdi.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*l3wvQbCxtccsYTsucjnIUg.jpeg" /><figcaption><strong>Farklı Text Search Kullanımları</strong></figcaption></figure><p>Peki ya bir kelime grubu aramamız gerekirse ? işte burada \ işaretine ihtiyacımız olacak. Ben bu örnek için ABD kısaltmasını UpdateOne ile açarak Amerika Birleşik Devletlerine dönüştürdüm.</p><p>Gördüğünüz gibi text search işlemleri de oldukça basit bir şekilde hallolmakta MongoDB’de. Dizi tipi verilerde kullanacağım kelime hariç tutarak arama ve case sensitive yani büyük ve küçük harfe duyarlı aramalara ise bir sonraki yazımda değineceğim.</p><p>Son bölümde kısaca yazının üzerinden geçmek gerekirse veri tabanlarındaki performans artışı için olmazsa olmaz indexleme işleminden ve MongoDB tarafındaki index yorumlarını inceledik. Yazının 2.bölümünde ise text search işlemlerinin farklı kullanımlarına değinmiş olduk. Bir sonraki ve muhtemelen dizinin son yazısı olacak olan dizi tipi verilerde de yine index ve text search işlemlerinin değinmediğim kısımlarına değineceğim. Bu yazıda yaptığım örneklerin kodlarına <a href="https://github.com/laerrof/MongoDBTutorial.git">github</a> hesabımdan ulaşabilirsiniz.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=81ca2320de5c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ADIM ADIM NOSQL VE MONGODB-4 : AGGREGATE İŞLEMLERİ]]></title>
            <link>https://medium.com/@enderkaderli/adim-adim-nosql-ve-mongodb-4-aggregate-i%CC%87%C5%9Flemleri%CC%87-4ecf3a6c08a9?source=rss-fb5a6dc5b9f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ecf3a6c08a9</guid>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[aggregate-function]]></category>
            <dc:creator><![CDATA[Ender Kaderli]]></dc:creator>
            <pubDate>Tue, 05 Mar 2024 00:33:51 GMT</pubDate>
            <atom:updated>2024-03-05T00:33:51.909Z</atom:updated>
            <content:encoded><![CDATA[<h3>ADIM ADIM NOSQL VE MONGODB-4 : AGGREGATE İŞLEMLERİ</h3><p>Bir önceki yazımda veri tabanlarının olmazsa olmazları olan filtreleme, sıralama ve sorgulama işlemleri ile sıklıkla kullanılan bazı operatörlere değinmiştik. Yazıya <a href="https://medium.com/@enderkaderli/adim-adim-nosql-ve-mongodb-3-fi%CC%87ltreleme-siralama-sorgulama-ve-yardimci-operat%C3%B6rler-e14794bb3fa3">linkten</a> ulaşabilirsiniz.</p><p>Bu yazımda ise veri işlemede en çok işimize yarayan kavramlardan olan pivot tabloların MongoDB yorumu olan aggregate işlemlerine değineceğim.</p><p>Pivot tablo mantığından kısaca bahsedersek elimizdeki verileri gruplandırdığımız ve bu grup gösterimleri sırasında grupların toplu şekilde işlem sonuçlarını da(toplam, ortalama, sayı…) görebildiğimiz sanal ya da fiziksel tabloları pivot tablo olarak isimlendirmekteyiz.</p><p>Kafanızda canlanması adına şöyle elimizde şöyle bir örnek olsun. Elimizde İstanbula ait Şubat ayı hava sıcaklıkları bulunsun. Yöneticiniz İstanbul’un Şubat ayı ortalama hava sıcaklığını sorduğunda tek tek tüm satırları ya da MongoDB için belgeleri toplayıp gün sayısına bölmek size ne kadar akılcı gelmekte ? İşte böyle bir senaryoda buradaki tüm rakamlarla tek tek işlem yapmak yerine ya da tek tek hepsini listelemek yerine oluşturacağımız pivot tablomuza ekleyeceğimiz ortalama sıcaklık alanına aggregate işlemleri ile yaptıracağımız bir ortalama hesaplama sonucunu yazarak hem talebe cevap vermiş hem de bunu yaparken gerek zaman gerekse de sistem kaynaklarından tasarruf sağlamış oluruz.</p><p>Dolayısıyla büyük verilerle çalışan kişiler için hem sorgu performansı hem sistem kaynaklarının optimum kullanımı noktalarında pivot tablolar hayat kurtarmaktadır.</p><p>Her veri tabanı sisteminde olan bu işlemler için MongoDB’nin de bir yorumu var. İsterseniz pivot tablo ve aggregate kavramları içerisinde daha fazla boğulmadan örneklerimize ve kullanacağımız operatörlere değinmeye başlayalım.</p><p>Başlangıcı <strong>$match </strong>operatörü ile yapalım. Bu operatör yapacağımız aggregate(kümeleme) işleminin hangi koşula göre olacağını belirlemek için kullandığımız operatördür. Ben ulkebilgi collectionımızdaki kıta bilgisinde Asya olan belgeleri kümeledim. Örneği görselden görebilirsiniz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*Rnw7heTD2tUF1tNlmR7g5g.png" /><figcaption><strong>$match Kullanımı</strong></figcaption></figure><p>Bir sonraki operatörümüz olan <strong>$group </strong>operatörümüz ise pivot tablo örneğinde anlattığım işlemleri yapabildiğimiz kümeleme operatörüdür ve içine bazı işlem operatörlerini de alır. $group operatörü örneğinden önce bu işlem operatörlerine de kısaca bakmanın faydalı olacağını düşünüyorum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*x4aXFrANL7JIKLjBiuXIUg.png" /><figcaption><strong>İşlem Operatörleri</strong></figcaption></figure><p>O zaman birkaç örnek yapalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*-2r1JFtV5ULp-WNr-UuIjA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*7yPebNZ2ZrigY2e_5tAsFw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*PHaSgzgxjP0TSaZZ5nOfBg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*hIpVP6f2Olp9dcjOQKENsA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*vTjWcgE21OfEbK1AhWUweA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*E3CETR_c34-64yBeXb8Mkg.jpeg" /><figcaption><strong>$group İle İşlem Operatörlerinin Kullanımı</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*i2LMYG9jQuvehiGQSMkcNA.png" /><figcaption><strong>$group İle $push Operatörünün Kullanımı</strong></figcaption></figure><p>Tüm örneklerde görüldüğü üzere belgelerde sanal alanların oluşturulmasına dikkat edilmeli. Öte yandan $ ile gösterilen alan isimleri yine aynı şekilde önemli. Zira alan adlarına $ işareti eklenmediğinde MongoDB bunu görmek istediğiniz gruba göre değil tüm belgelere göre gruplandırma yapmaya çalışır. Öte yandan $push bloğu içerisinde kullanılmayan $ işareti sonucu MongoDB bunu alan olarak değil değer olarak alacağı için gruplandırma yapılmayacaktır.</p><p>Aggregate işlemlerinde kullandığımız bir diğer operatörümüz olan <strong>$project </strong>ise bize görmek istediğimiz alanları belirlememize yardımcı olur. Bununla ilgili de bir örnek yapalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*_Vy0cMcZc0udxhsuejO8pA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*uMNnxnxepGQzK3pGSCE7Ow.jpeg" /><figcaption><strong>$project Kullanımı</strong></figcaption></figure><p>Kıtalara göre yapacağım gruplama işlemlerinde en küçük yılı görmek istiyorum. İlk görseldeki $project kod bloğunu incelediğimizde(buradaki değerlere dikkat !) _id alanı için 0 yani görmek istemediğimi Kıta için ise $group içerisinde belirlediğim _id alanını görmek istediğimi ve son olaraksa MinYıl alanını görmek istediğimi belirtiyorum.</p><p>$group içerisindeki _id alanı için belirttiğim “$Kıta” alanı ile $project içerisinde Kıta için belirttiğim “$_id” alanları muhtemelen kafanızı karıştırmıştır.</p><p>Burada yapmak istenene değinmek gerekirse; $group içerisinde Kıta alanına göre gruplama yapmak istediğimi ve yapılan gruplarda en küçük yılı görmek istediğimi belirtiyorum. $project alanında ise alanların gösterimde birbirlerini tekrar etmemesi için _id alanını 0 girip kaldırıyorum(_id alanına 1 yazarak sonucun tekrar ettiğini görebilirsiniz). Kıta alanında ise $group kodu içerisinde tanımladığım _id alanını ekleyerek kıtalara göre en küçük yılı tekrarsız gösteriyorum.</p><h3>COUNT() VE DISTINCT() İŞLEVLERİ</h3><p>Her ne kadar <strong>count()</strong> ve <strong>distinct()</strong> işlevleri sözdizimi yapısı olarak aggregate() işlevi içerisine tanımlanmasa da genel olarak bu iki işlev de kümeleme içerisinde önemli işlevlere sahip olduklarından kendilerinden bahsetmeyi aggregate yazısında uygun buldum. O zaman count() ile başlayalım.</p><p>Count() işlevi db içerisinde tanımlayacağımız parametrelere göre bize belge sayısını veren işlevdir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*NAhjeP4YnRQbOEWcR2-VQQ.png" /><figcaption><strong>Count() Kullanımı</strong></figcaption></figure><p><strong>Distinct()</strong> ise tekrar etmeyen verilerimizi göstermek adına kullandığımız bir işlevdir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/418/1*6zbDg_hM3tlKylYvMTI2Hg.png" /><figcaption><strong>Distinct() Kullanımı</strong></figcaption></figure><p>ulkebilgi collectionımız içerisindeki belgelerimizde normal şartlarda yıl alanını içeren 4 adet belge vardı. Distinct() işlevine “Yıl” alanını parametre olarak eklediğimizde bize 3 adet çıktı döndürdü. Zira hem Türkiye hem Almanya için yıl alanı 1923 idi.</p><p>Bu yazıda veri tabanı sistemlerinin en önemli işlemlerinden olan aggregate(kümeleme) işlemlerine mümkün mertebe anlatımı yalın fakat gerekli bilgileri atlamadan değinmeye çalıştım. Başlangıç seviye olan örnekleri farklı öykülerle elbette çeşitlendirebilirsiniz. Bir sonraki yazımda ise MongoDB’de index ve text search işlemlerini ele alacağım. Bu yazıdaki kodlara <a href="https://github.com/laerrof/MongoDBTutorial">Github</a> hesabımdan ulaşabilirsiniz.</p><p><strong>İletişim</strong></p><p><strong>Linkedin : Ender Kaderli</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ecf3a6c08a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ADIM ADIM NOSQL VE MONGODB-3 : FİLTRELEME, SIRALAMA, SORGULAMA VE YARDIMCI OPERATÖRLER]]></title>
            <link>https://medium.com/@enderkaderli/adim-adim-nosql-ve-mongodb-3-fi%CC%87ltreleme-siralama-sorgulama-ve-yardimci-operat%C3%B6rler-e14794bb3fa3?source=rss-fb5a6dc5b9f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/e14794bb3fa3</guid>
            <category><![CDATA[sorting]]></category>
            <category><![CDATA[mongodb]]></category>
            <category><![CDATA[filtering]]></category>
            <dc:creator><![CDATA[Ender Kaderli]]></dc:creator>
            <pubDate>Thu, 29 Feb 2024 07:49:59 GMT</pubDate>
            <atom:updated>2024-03-05T00:35:46.797Z</atom:updated>
            <content:encoded><![CDATA[<h3>ADIM ADIM NOSQL VE MONGODB-3 : FİLTRELEME, SIRALAMA, SORGULAMA VE YARDIMCI OPERATÖRLER</h3><p>Bir önceki yazımda MongoDB ortamı kurulumu ve CRUD işlemlerinden bahsetmiştim. Yazıya <a href="https://medium.com/@enderkaderli/adim-adim-nosql-ve-mongodb-2-kurulum-ve-crud-i%CC%87%C5%9Flemleri%CC%87-6b69646e8bf3">linkten</a> ulaşabilirsiniz.</p><p>Serinin 3. yazısında artık yığın veriden ihtiyacımız olan veriye ulaşabilme noktasında ihtiyacımız olan filtreleme, sıralama, sorgulama ve sık kullanılan bazı operatörlere değineceğim.</p><p>Veri tabanları ihtiyaca göre özelleştirilmiş veri yığınlarını yönetmemizde olmazsa olmazlarımızdır. Günümüzde veri aldığımız kaynakların ve aldığımız veri tiplerinin çeşitlenmesinden mütevellit yönetmemiz gereken veriler hem nitelik hem nicelik olarak kontrolü zor boyutlara ulaşıyor her geçen gün. İşte bu noktada veri tabanı ile çalışan meslek gruplarının cevap bulması gereken en temel soru ortaya çıkıyor. “Devasa veri yığınları içerisinden ihtiyacım olan veriye nasıl ulaşır ve bu veriden faydalı neticeleri nasıl çıkartırım ?”</p><p>Bu noktada sorunun ilk kısmına cevaben MongoDB de tüm veri tabanlarının sunduğu gerekli araçları sunmakta. Gerek filtreleme gerek sıralama işlemleri ile veri tabanından sadece ihtiyaç kadar olan veriye ulaşmak MongoDB için de oldukça kolay ve hızlı.</p><p>O zaman daha fazla vakit kaybetmeden veri filtreleme işlemlerine başlayalım.</p><h3>FİLTRELEME İŞLEMLERİ</h3><p>Aslında bir önceki yazımdaki CRUD işlemlerinin read aşamasında dolaylı olarak değinmiştik desem filtrelemeler için yanlış bir ifade kullanmış olmam. Hatırlarsanız bir önceki yazıda yaptığımız tüm işlemlerle ilgili işlemin başarılı olup olmadığını görmek adına verilerin son haline bakmak için kullandığımız <strong>“find” </strong>işlevimiz vardı. İşte MongoDB’de “db.collectionadı.find()” ile ilgili collectiondaki tüm belgelere ve içindeki verilere ulaşırken artık find sonrası gelen parantezi koşullarımıza göre doldurarak filtreleme işlemlerini kolayca yapabilmekteyiz.</p><p>Konunun kavranması adına hemen basit bir örnek yapalım. Ülke veri tabanı içindeki ülke bilgisi collectionımız üzerinde basit bir filtreleme deneyelim ve ülke adı Türkiye olan kaydı sıralayalım. Burada bu filtrelemeyi yaparken süslü parantezlere ihtiyaç duyacağız.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*FwUi5srMohUtufA30r4V3Q.png" /><figcaption><strong>Filtreleme İşlemi</strong></figcaption></figure><p>Gördüğünüz üzere oldukça basit bir şekilde filtreleme işlemini yaptık. find fonksiyonu içerisine {filtrelenecek alan : “Filtre koşulu”} kalıbı işimize yarayacak.</p><p>Basit birkaç örnek daha yapalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*A_CVN6ufF0lNmswNa_HdQg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*5zeiUfETH2X_wNzhSzHelA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*dFdDK7PmurTbXMYf0z49DQ.jpeg" /><figcaption><strong>Filtreleme İşlemleri</strong></figcaption></figure><p>Peki işleri biraz daha zorlaştırıp daha karmaşık filtreleme işlemlerine ihtiyacımız varsa ? İşte burada mantıksal operatörler ve karşılaştırma operatörleri yardımımıza koşuyor.</p><p>Mantıksal operatörleri Sql tarafındaki karşılıklarıyla karşılaştırarak örneklendirmenin öğrenme noktasında daha fazla işimize yarayacağını düşünüyorum. Bunun için aşağıdaki tabloya göz gezdirmenizi öneririm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/593/1*xpf6EJ7g2dfdsV_6lw-u8g.png" /><figcaption><strong>Mantıksal Operatörler</strong></figcaption></figure><p><strong>$nor </strong>operatörünün Sql tarafında herhangi bir karşılığın bulunmaması dikkatinizi çekmiştir. Bu operatörü ayrıca ele alacağız. Şimdi bu operatörler ile basit örnekler yapalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*WmrDgJHIn0BnUOOC607yyw.png" /><figcaption><strong>$or ve $and Operatörleri Kullanımı</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*oKDJmSIdtyW2BjRyZ_-6cQ.png" /><figcaption><strong>$not Kullanımı</strong></figcaption></figure><p>$not kullanımındaki farklılık dikkatinizi çekmiştir. Burada mantıksal operatörü arayacağımız belgenin içerisine bir filtre olarak ekledik diğerlerinden farklı olarak ve $eq(eşittir) operatörünü de kullandık. Bu sorgumuzda ulkebilgi collectionımızdaki isminde “Almanya” olmayan belgeleri görmek istedik.</p><p>MongoDB’deki mantıksal operatörlerin Sql ile benzer şekilde çalıştığını gördük. Peki ya <strong>$nor </strong>?</p><p>İşte MongoDB’nin jokerlerinden birisine geldik şimdi. Mantık olarak $nor bize filtrede eklediğimiz iki ayrı koşula da uymayan ifadeler için true döndürecektir. Bir örnek ile açıklamak istersek şayet aşağıdaki görseli inceleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*ClACbxEkOpS8khnt6UKYZw.png" /><figcaption><strong>$nor Kullanımı</strong></figcaption></figure><p>Kod örneğini incelersek 2 ayrı koşulun filtre olarak eklendiğini görmekteyiz. $nor kod betiğine ülke adı “Brezilya” olan ve yıl bilgisi 1938 olan belgeleri bize getirmesini söyledik. Fakat bildiğiniz gibi ulkebilgi collectionımızda her iki koşula birden uyan kaydımız olmadığı için kodumuz true döndü ve Türkiye ile Almanya belgelerini bize getirdi.</p><p>Peki iki koşulumuz ya da koşullardan birisi true olması durumlarında $nor bize nasıl bir sonuç döndürüyor ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*H87elJmJT-4ih7pT_cBd8Q.png" /><figcaption><strong>$nor Kullanımı-2</strong></figcaption></figure><p>Gördüğünüz üzere koşullardan en az birisi true olduğunda $nor bize false döndü ve herhangi bir kayıt bulamadı.</p><p>Mantıksal operatörlerin nasıl çalıştığını anlattıktan sonra sırada ağırlıklı olarak string veriler için kullandığımız karşılaştırma operatörlerimiz var. Öncelikle mantıksal operatörlerde olduğu gibi bir tablo ile Sql tarafındaki karşılıklarını göstereceğim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*FdmG9Z7FJEuBrT00bJUEoQ.png" /><figcaption><strong>Karşılaştırma Operatörleri</strong></figcaption></figure><p>Şimdi bu karşılaştırma operatörlerine dair örnekler yapalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*fhf2et4EDDdw6RPIziEstA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/1*7bYoRNrnFXzxmv-LsdgAlQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*jF_Vh--4dsqHyaMv-pJlpg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*YK1bRtbEfPNFLSPfEAp7wA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*VfatUPIhBWxmaP1rtqcgIQ.jpeg" /><figcaption><strong>Karşılaştırma Operatörleri</strong></figcaption></figure><p>Görselleri incelediğinizde özellikle ilk 3 görselde sadece bulunmasını istediğimiz alanların olduğunu görmekteyiz. Filtreleme sonrası görmek istediğimiz alanlar için 1 yazarak sadece talep ettiğimiz alanları datada getirebiliyoruz. Bu da ufak bir bilgi olarak bir köşede dursun.</p><p>$in ve $nin operatörlerini de tamamladığımıza göre filtrelemeyi bitirip sıralama işlemlerine geçeceğiz derken aklıma son bir filtreleme işlevi daha geldi. Peki ya bir belgede string ifadelerin parçalarını aramak istersek ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*dAP_hdhdNzfoYRyP7lT7rQ.png" /><figcaption><strong>Regex Filtre</strong></figcaption></figure><h3>SIRALAMA İŞLEMLERİ</h3><p>Bir verinin devasa veri tabanlarından istenildiği şekilde filtrelenip ihtiyaç kadar olan kısmıyla çalışılması ne kadar önemliyse o verinin sıralı şekilde gösterilmesi de oldukça önemlidir. Zira veri üzerinde çalışan kişi bazen yaptığı filtrelemeler neticesinde yine büyük veri yığınları arasında kalabilir. Bu sebeple eldeki verilerin sınırları görülmek istenebilir. İşte bu noktada tüm veri tabanı sistemlerinde olduğu gibi MongoDB’de de sıralama(sorting) işlemleri devreye girer. Artan ve azalan standart olan sıralama işlemlerinin yanı sıra birden fazla alana göre sıralama yapmak da mümkündür. Oldukça basit olan bu işlemleri isterseniz birkaç örnek ile görelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/650/1*bIWAacxn0_ZjXFI2EoHBzQ.jpeg" /><figcaption><strong>Sıralama İşlemleri</strong></figcaption></figure><p>Aslında sıralama işlemlerinin oldukça basit bir yapısı var ve burada sıralama işlemi için <strong>sort </strong>işlevine ihtiyaç duyduk. Yukarıdaki görselde hem artan hem de azalan sıralama işlemini gerçekleştirdik. Gelin şimdi bir de yazdığımız kodları yakından inceleyelim.</p><pre>db.ulkebilgi.find(<br>  {},<br>  {Ad : 1 , UlkeKodu : 1 , _id : 0}).sort(<br>  {UlkeKodu : -1 } )</pre><p>Kodun ilk kısmı sıradan, sürekli kullandığımız bir find sorgusu. Buraya kadar her şey normal.</p><p>2.satırda içi boş bir süslü parantezimiz var. Burada kodumuzdan bizim için collectionımız içinde bulunan tüm belgelerde işlem yapmasını istiyoruz.</p><p>3.satırın ilk kısmı ise karşılaştırma operatörleri sırasında kullanmış olduğumuz sadece istenen alanların belge içinde gösterilmesi kısmı.</p><p>Gelelim 3.satırın 2.kısmına. İşte burada sıralama işlemimiz başlamakta. Bunun için <strong>sort() </strong>işlevine ihtiyaç duyuyoruz. En kaba ifadeyle sort yapısındaki parantezimizin içini belgeler içindeki hangi alana göre ve hangi şekilde(artan,azalan) sıralayacağımız ile dolduruyoruz. Burada dikkat edilmesi gereken son nokta ise 1 artan -1 azalan sıralamayı göstermekte. Yani farklı bir sıralama için kodu sil baştan yazmanıza gerek yok. Sadece 1 ya da -1. Bu kadar basit.</p><p>Sıralama işlemleri içerisinde son olarak değinmek istediğim nokta ise birden çok kritere göre sıralama yapmak istersek neler değişmekte ? Gelin görsele bakalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*NDKwB5RDlvlCiTPEZ9Rh0g.jpeg" /><figcaption><strong>Çok Koşullu Sıralama</strong></figcaption></figure><p>Görüldüğü üzere yapıda herhangi bir değişiklik yok. Sadece sıralanacak kriter listesine göre sıralama koşullarımızı ekliyoruz. Bu örneğimizde önce yıla göre artan bir sıralama istedik kodumuzdan sonrasında ise ülke kodlarına göre azalan bir sıralama yapmasını talep ettik.</p><p>İşte sıralama işlemleri MongoDB için özetle bu kadar. O zaman bu yazının son konusu olan sorgulama işlemlerine geçelim.</p><h3>SORGULAMA İŞLEMLERİ</h3><p>Demek isterdim ki geldik dananın kuyruğunun koptuğu yere. Ama laf aramızda aslında sorgulama işlemlerine konu olacak operatör ve fonksiyonların büyük kısmına filtreleme ve sıralama işlemleri içerisinde değindim. Peki bu başlıkta neler göreceğiz ?</p><p>Aslında bu başlık içine bu yazıyı yazarken ki değiştirdiğim şehirlerde olan gezi notlarımı yazsam sanki daha eğlenceli olurdu. Zira yazıya İstanbul’da havalimanında uçak beklerken başlamıştım. Kalan kısımları ise sırasıyla İzmir, Manisa, Uşak ve Kütahya arasında gezerken bulduğum boşluklarda yazabildim ki o sebeple biraz daha uzun sürdü bu yazı zaman olarak. Belki o şehirlere ait gezi notlarımı da ayrıca bir gün bir yerlerde paylaşırım… Neyse biz işin eğlenceli kısmını bırakıp konumuza geri dönelim.</p><p>Filtreledik, sıraladık derken MongoDB içerisinde işimize yarayacak pek çok sorgulama işlemini yaptık. <strong>$exists </strong>operatörü ile<strong> limit(), skip() </strong>ve<strong> type() </strong>işlevlerini ise bu başlık altına bıraktım. O zaman daha fazla vakit kaybetmeden bu yazının son virajına girelim.</p><p>Öncelikle ulkebilgi collectionımıza biraz daha belge ekleyerek başlayalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*Fh_HX988P3UPOQdMvWULwA.png" /><figcaption><strong>Belge Ekleme</strong></figcaption></figure><p>$exists dediğim zaman muhtemelen Sql ile çalışan arkadaşların kafasında bir ışık yanmıştır. Ama ne yazık ki bu exists o exists değil. MongoDB exists ile bize belgelerimizde bulunmayan alanları göstermekte. İsterseniz hemen basit bir örnek yapalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/579/1*Y8ClHv_qy27EK2VrInHRVA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/621/1*Ea3fJ60DE85qv5bXJ6wbEg.jpeg" /><figcaption><strong>$exists Kullanımı</strong></figcaption></figure><p>İlk örneğimizde yıl alanı olmayan belgeleri 2.örnekte ise nüfus alanı olan belgeleri gördük. Burada exists işlevinin true ve false olarak parametreler alacağını unutmayın.</p><p>Bir sonraki işlev olan <strong>$limit </strong>ise collection içerisinde verilerimizi görmek istediğimizde kaç adedini göreceğimize karar vermemize yarar. MongoDB normal şartlar altında sorgulama esnasında maksimum 40 adete kadar belgeyi gösterebilmektedir. Fakat bu hem belgelerin görünümünü hem de yönetimini zorlaştırmakta. Aslında burada yaptığımız işlem Sql deki select top x from dbo.y sorgusunun x kısmına tekabül etmekte. O zaman basit bir örnekle limit() işlevini çalıştıralım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/1*LkGGP8yIFmzQr54tLIfJUA.png" /><figcaption><strong>limit() İşlevi Kullanımı</strong></figcaption></figure><p>Burada dikkat edilmesi gereken nokta limit() işlevini find() içerisine yazmadık.</p><p>Peki ya görmek istediğimiz belgelerin bir kısmını görmek istemezsek ? Ve bunu da sırayla yapmak istersek ? İşte burada imdadımıza <strong>skip() </strong>işlevi yetişmekte. son eklediklerimizle birlikte toplamda 5 adet belgemiz olmuştu. Şimdi ben bunların ilk 2 tanesini görmek istemiyorum. O zaman skip işlevimizi burada çalıştıralım ve sadece sonradan eklediğimiz 3 kaydı görelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*eiYiECs805rQeaj_z4n7ww.png" /><figcaption><strong>skip() İşlevi Kullanımı</strong></figcaption></figure><p>Burada dikkat edeceğimiz nokta skip() işlevi parametre olarak 0 dan büyük ve tam sayı değerler almaktadır.</p><p>Son işlevimiz olan <strong>type() </strong>işlevini de inceleyelim. MongoDB’yi anlatırken JSON yerine BSON veri tipinden bahsetmiştim ve MongoDB’nin JSON aksine BSON formatında belgelerin içindeki verileri istediğimiz veri tipinde tutabildiğine değinmiştim. Sorgulamamızı yaparken farklı veri tiplerinin tutulduğu belgeleri görmek istediğimizde yolumuz ise type() işlevinden geçmekte. Basit bir örnekle type() kullanımına bakalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*dFhbcdFea7dVVBuLdtOJPg.png" /><figcaption><strong>type() İşlevi Kullanımı</strong></figcaption></figure><p>type() için 2 ayrı kod örneği yazdım ilk kod örneğimde Ad alanında “number” tipinde veri olan belgelerin gelmesini istedim ve doğal olarak sorgu boş olarak geldi. Laf aramızda herhalde hiçbir ülke yok ki ismi rakamlardan oluşsun.</p><p>Diğer sorgumuzda ise aynı alanda bu sefer string tipinde veri tutulan belgeleri görmek istedik ve bize limit(2) dediğimiz için ilk 2 belgeyi getirdi. Görüldüğü üzere type() kullanımı oldukça basit.</p><p>Aggregate işlemlerine değindiğim bir sonraki yazıma <a href="https://medium.com/@enderkaderli/adim-adim-nosql-ve-mongodb-4-aggregate-i%CC%87%C5%9Flemleri%CC%87-4ecf3a6c08a9">linkten</a> ulaşabilirsiniz. Bu yazıda yazdığım kodlara da github hesabımdan ulaşabilirsiniz. <a href="https://github.com/laerrof/MongoDBTutorial/tree/main">Linki</a> de şöyle bırakmış olayım.</p><p><strong>İletişim</strong></p><p><strong>Linkedin : Ender Kaderli</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e14794bb3fa3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ADIM ADIM NOSQL VE MONGODB-2 : KURULUM VE CRUD İŞLEMLERİ]]></title>
            <link>https://medium.com/@enderkaderli/adim-adim-nosql-ve-mongodb-2-kurulum-ve-crud-i%CC%87%C5%9Flemleri%CC%87-6b69646e8bf3?source=rss-fb5a6dc5b9f2------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b69646e8bf3</guid>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[crud-operations]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Ender Kaderli]]></dc:creator>
            <pubDate>Thu, 22 Feb 2024 12:35:05 GMT</pubDate>
            <atom:updated>2024-02-29T10:37:27.521Z</atom:updated>
            <content:encoded><![CDATA[<h3>ADIM ADIM NOSQL VE MONGODB-2 : KURULUM VE CRUD İŞLEMLERİ</h3><p>Bir önceki yazımda biraz veri yapılarına ve Sql ile NoSql gibi kavramlara değinmiştim. İlgili kavramlarda yeni olan ya da hiç aşina olmayanlar için mümkün mertebe kısa tutmaya ve anlaşılır olmasına gayret ettim. Yazıya <a href="https://medium.com/@enderkaderli/adim-adim-nosql-ve-mongodb-aca12fb8ce54">şuradan</a> ulaşabilirsiniz.</p><p>MongoDB ve NoSql için kısa tanımlamaların arkasından bu yazıda Windows için MongoDB’yi çalıştıracağımız ortam kurulumları ve her veri tabanı sorgulama dilinin olmazsa olmazı <strong>C</strong>reate <strong>R</strong>ead <strong>U</strong>pdate <strong>D</strong>elete(CRUD) işlemlerinden bahsetmeye çalışacağım.</p><p>Ben geliştirme ortamı olarak Windows ortamını ve <strong>MongoDB Compass </strong>yazılımını tercih ettim.</p><p>Öte yandan Python ve R gibi dillerde doğrudan kütüphaneler ile MongoDB üzerinde çalışmanız mümkün. Fakat bu çalışmada ilgili diller üzerinde çalışmayacağım için bu kütüphanelere değinmeyeceğim. İlerleyen zamanda duruma göre belki o kütüphaneler için de kılavuzlar oluşturabilirim. Fakat meraklısı arkadaşlar için Python’da pymongo ve R’da ise mongolite kütüphaneleri MongoDB ile çalışmanızı sağlar.</p><h3>MONGODB COMPASS KURULUMU</h3><p>Önce ilgili setup dosyasına ihtiyacımız olacak <a href="https://www.mongodb.com/try/download/shell">linkten</a> sisteminize uygun dosyayı indirerek kuruluma başlayabilirsiniz.</p><p>Burayı kısa tutmak istedim zira kurulum oldukça basit ve ekstra ayar gerektirmeden next diyerek kurulum gerçekleştiriliyor.</p><h3>MONGODB COMPASS EKRANI</h3><p>Kurulum tamamlandıktan sonra kurulan programı açtığımızda aşağıdaki gibi bir ekranla karşılaşacağız.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZM8emFr3BdoOI_73y8UZJQ.png" /><figcaption><strong>MongodDB Compass Ana Ekran</strong></figcaption></figure><p>Ben daha önce üzerinde çalıştığım için Recents seçeneğinin altında yaptığım bağlantılarla ilgili bilgiler mevcut. Sizlerde o kısım boş olacaktır.</p><p>Oldukça basit bir arayüze sahip bu kısımda doğrusu yapacağımız çok fazla bir şey yok. Aslında farklı bağlantı seçenekleri mevcut ve Advanced Connection Options seçeneğine tıkladığınızda pek çok alt menü gelmekte fakat hepsini tek tek açıklamayacağım.</p><p>Bu arayüzde bize lazım olan kısım ise yeni bağlantı oluşturma kısmı. Ben bağlantı olarak dış kaynağa bağlanmak yerine MongoDB’nin kendi portu olan 27017 numaralı portunda çalıştım. Fakat siz isterseniz URL kısmını ilgili veri tabanının port ve URL bilgileriyle değiştirerek dış kaynaktaki verilerle çalışabilirsiniz.</p><p>Ekrandaki yeşil renkteki Connect butonuna tıkladığınızda MongoDB’nin local portuna direkt bağlanacaksınız ve aşağıdaki gibi bir ekran karşınıza gelecek.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iPqDHVnDu8L0qtqU3rTzRQ.png" /><figcaption><strong>Connection Ekranı</strong></figcaption></figure><p>Tabii ben daha önce otomobil, kitaplar ve okul veri tabanlarını oluşturduğum için sizlerde çıkan ekranda bu 3 veri tabanı olmayacak.</p><h3>VERİ TABANI VE COLLECTION OLUŞTURMA</h3><p>Başlangıçta collection ifadesini tanımlamamız gerekli. Sql veri tabanlarında satır ve sütunlardan oluşan yapısal verileri içeren tablolardan bahsetmiştik. Fakat NoSql tarafında ise böyle bir veri ve tablo yapısından bahsedemiyoruz. Bunun yerine ise MongoDB’de farklı veri formatları tablolar yerine collectionlarda <strong>BSON</strong> formatında tutulmaktalar.</p><p>Nedir bu BSON derseniz onu da şöyle kısaca açıklayalım. JSON verilere hepimiz aşinayızdır. Fakat JSON formatındaki veriler için veri tipi ayarlaması yapamayız lakin MongoDB’nin BSON formatı bu konuda bize kolaylık sağlar ve tutulacak verinin formatını kendimiz belirleyebiliriz ki program geliştiriciler için bunun ciddi bir artı olduğunu söylemekte yarar var.</p><p>Özetle collection ifadesini Sql tarafındaki tablolar gibi düşünmekten zarar gelmez.</p><p>Şimdi yeni bir veri tabanı ve collection oluşturalım. Burada önümüzde 2 seçenek var. İster bunu Mongo Shell ile kodlayarak istersek de arayüzden fare yardımıyla yapabiliriz. Her ikisini de açıklayacağım.</p><p>Önce ekrandan başlayalım. Databases seçeneği yanındaki + işaretine tıkladığımızda aşağıdaki gibi bir ekranla karşılaşacağız.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*dyGGjmN5TFJl-szuJeURrw.png" /><figcaption><strong>Databases Ekranı</strong></figcaption></figure><p>Bu ekranda oluşturmak istediğimiz veri tabanı ve collection ismini giriyoruz. Ben şehirler isminde bir veri tabanı oluşturdum ve altına da şehir bilgi adında bir collection ekledim. Bu arada zaman serisi şeklinde de collection oluşturmanız mümkün. Bilgileri girdikten sonra create database butonuna tıklayınca aşağıdaki ekranla karşılaşıyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vvAWEW9T7hj055PqksvLyA.png" /></figure><p>Bu ekranda oluşturduğumuz collection için CRUD işlemleri butonları var. İşin doğrusu ben Add Data haricinde hiçbirisini kullanmadım. Add data adı üzerinde olduğu üzere veri eklemeye yarıyor. Kullanacağınız verinin JSON ya da CSV formatındaki dosyasını çıkan menüden bularak ekleyebiliyorsunuz.</p><h3>PEKİ YA BU İŞLEMİ SCRIPT İLE YAPMAK İSTESEYDİK ?</h3><p>İşte benim için MongoDB’nin alamet-i farikası olan Mongo Shell artık devreye giriyor. Mongo Shelle ulaşmak için bir üstteki ekranın sol alt köşesindeki <strong>MONGOSH </strong>yazısına tıklamanız yeterli.</p><p>Karşımıza şöyle bir konsol ekranı gelmekte.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-tG51hCkqJ-xYN0lq9z96w.png" /><figcaption><strong>Konsol Ekranı</strong></figcaption></figure><p>Bu sefer de ülkeler isminde bir veri tabanı ve ülke bilgi adında bir collection oluşturalım.</p><p>test&gt; yanına <strong>use ulke </strong>yazıp entera bastığımızda Mongo Shell önce ulke isminde bir veri tabanı var mı ona bakacak. Eğer böyle bir veri tabanı varsa ona geçiş yapacak yoksa yenisini oluşturacak.</p><p>Şimdi geldik collection oluşturmaya. Bu da basit bir komut ile oluşturulmakta. <strong>db.createcollection(“ulkebilgi”) </strong>yazarak collectionımızı oluşturuyoruz ve aşağıdaki ekran oluşuyor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*bK0OLL1_tVNE2P54oLFPkw.png" /><figcaption><strong>Mongo Shell Ekranı</strong></figcaption></figure><p>Görüldüğü üzere &gt; işareti bizim girdiğimiz kodu &lt; işareti ise Mongo’nun bize döndüğü cevabı göstermekte. Buradaki {ok:1} ibaresi dikkatinizi çekmiştir. Bu bize 1 adet collectionın başarılı bir şekilde oluşturulduğunu göstermekte.</p><p>Gördüğünüz gibi Mongo Shell üzerinde oldukça basit bir kodlamayla veri tabanı ve collection oluşturduk. Artık daha eğlenceli olacağını düşündüğüm CRUD işlemlerine başlayabiliriz.</p><h3>CRUD İŞLEMLERİ</h3><p>Bir veri tabanının tabir-i caizse “Hello World” kısmıdır CRUD işlemleri. Tüm veri tabanlarının olmazsa olmazı olan bu işlemler yazının başında belirttiğim üzere <strong>C</strong>reate <strong>R</strong>ead <strong>U</strong>pdate <strong>D</strong>elete kelimelerinin ilk harfleridir.</p><p>Create : Collection oluşturma kısmında aslında bu işlemi yapmıştık fakat oluşturduğumuz collection içerisine veri tanımlamadık. İşte burada yapacağımız insert(ekleme) işlemini create çatısı altında incelemek istiyorum.</p><p>Şimdi Mongo Shell üzerinde aşağıdaki kodları yazarak oluşturduğumuz ulkebilgi isimli collectiona belgeler ekleyelim. Belge tabiri ise collectionlar içerisinde tuttuğumuz alanlardır. Bu arada ilgili kodların github linkini paylaşacağım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*A0B4OWPEagujsQphGuPGvQ.png" /><figcaption><strong>Insert İşlemi</strong></figcaption></figure><p>Burada parantez kullanımları oldukça can alıcı. Zira görüldüğü üzere hem normal parantez hem köşeli parantez hem de süslü parantez kullanımı var. Bu arada Mongo Shell de alt satıra geçmek için Ctrl+Enter tuş kombinasyonunu kullanabilirsiniz.</p><p>Şimdi kontrol edelim bakalım belgelerimiz ve içindeki verilerimiz collectionımıza eklenmiş mi ? Bunu kontrol etmek için collectionımıza bir bakalım. Bu işlem için find komutunu kullanalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*_adCSMsk6ZRCJdu2uLSqYQ.png" /><figcaption><strong>Verilerin Kontrol Edilmesi</strong></figcaption></figure><p>Görüldüğü üzere <strong>db.ulkebilgi.find()</strong> kodu ile collectiondaki kayıtları listelediğimizde eklediğimiz 4 ülke eklenmiş. Burada dikkat çekmek istediğim bir nokta var. Shell üzerinden herhangi bir collection ile alakalı işlem yapmak istediğinizde db.collectionadı.komut() gibi standart bir yapı mevcut.</p><p>Bir sonraki işlem olan read işlemine geçeceğim fakat orada da find() komutu ile bunu gerçekleştirdik. Fakat komutun farklı bir kullanımı olan <strong>findOne() </strong>ile sadece belirleyeceğimiz ifadeye ait görünüm için bir örnek yapalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/546/1*dp7uhTsuzH0P3ZfY4PofOQ.png" /><figcaption><strong>Findone ile Read İşlemi</strong></figcaption></figure><p>find fonksiyonu aslında çok sık ihtiyaç duyacağımız veri filtrelemenin giriş kapısı denebilir. Tabii şimdilik detaylı olarak filtreleme konusuna girmeyeceğim. İlerleyen yazılarda detaylıca anlatıyor olacağım find ve filtreleme işlemlerini.</p><p>Collection oluşturduk, içine belgeleri ve verileri ekledik, eklediğimiz verileri gördük peki sırada ne var ? Sırada update işlemi var.</p><p>Zaman zaman veriler üzerinde manuel olarak güncelleme işlemleri ihtiyacı doğar. Her ne kadar manuel işlemler eldeki veriyi insan hatasına karşı daha savunmasız bırakıyor olsa da gerektiği anda verilerimizi manuel şekilde update edebilmek gerek Sql gerekse de NoSql tüm veri tabanı sistemleri içerisinde tanımlanan büyük bir özgürlüktür.</p><p>Peki MongoDB bunu nasıl yapıyor ?</p><p>Burada çoğumuzun aklından basit bir db.ulkebilgisi.update(…) gibi bir kod geçti muhtemelen. Fakat bu yeterli değil. Burada bazı yardımcı operatörlere de ihtiyacımız olacak.</p><p>Önce $set operatöründen bahsedelim. Örnek olarak ise ülke bilgisi collectionı içerisinde ABD için olan kıta bilgisinde Kuzey Amerika demiştik şimdi bunu Amerika olarak güncelleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*UU6glK5WkKfpIQZMZ7P-GQ.png" /><figcaption><strong>$set İle Update İşlemi</strong></figcaption></figure><p>Kodu incelediğimizde yapı olarak en kaba haliyle şöyle bir mantık güdebiliriz.</p><p>db.ulkebilgi.update(</p><p>{değişecek ifadenin bulunması } , {$set : {yeni değer1 , yenideğer2 , …}}</p><p>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*EckDzENgKYVkcRtTiU6ZIg.jpeg" /><figcaption><strong>ID Alanı Üzerinden Güncelleme</strong></figcaption></figure><p>Burada dikkatinizi çekmek istediğim bir nokta daha var. Değişecek ifadeyi bulurken id üzerinden değiştireceğimiz ifadeyi bulmasını istedik sorgunun. Aslında id değerinin unique(benzersiz) olmasından mütevellit doğru olan da buydu bence. Peki id ye mecbur muyuz ? Tabii ki de hayır.</p><p>Gelin aynı güncellemeyi bir de ülke ismi üzerinden yapalım ve sorgudan şunu isteyelim. “Bana adı ABD olan ülkeyi bul ve kıta değerini Amerika olarak değiştir.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/1*dJMNzm8NUGPmjXKv1A7J-w.png" /><figcaption><strong>Ad Alanı Üzerinden Güncelleme</strong></figcaption></figure><p>Find ile yaptığımız değişikliğe baktığımızda her iki şekilde yapılan güncellemenin sonuç olarak aynı noktaya çıktığını görmekteyiz. Bu şekilde yapılacak bir güncelleme kullanıcının ihtiyacına göre farklı alan adları üzerinden de yapılabilir.</p><p>Peki ya birden fazla alan üzerinde güncelleme yapacaksak ? Değişen bir durum yok. Aynı yapı tekrar devreye girecek olup sırayla yapılacak diğer değişikleri ekleyeceğiz.</p><p>Az önce kıta bilgisini Amerika olarak değiştirdiğimiz ABD için bu sefer şöyle bir şey yapalım. Kıta “Kuzey Amerika” ve ad ise “Amerika Birleşik Devletleri” olsun.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GusNyIvIPOnk8SML_DWj6Q.png" /><figcaption><strong>Birden Fazla Alan Güncellemesi</strong></figcaption></figure><p>Peki senaryomuza şöyle bir ekleme yapsak ? ABD için kıta bilgisini tekrar “Amerika” yapalım ama bu sefer ve Rusya için de kıta bilgisini “Avrupa” yapalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*SygLXrtrjYkejO4B2zHw7g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/1*csNg7w0UBGNgLU54qorFdg.jpeg" /><figcaption><strong>Ayrı Belgelerde Güncelleme</strong></figcaption></figure><p>İlk görselde çoklu güncelleme kodu diğer görselde ise güncelleme sonucunda ortaya çıkan değerler mevcut. Dolayısıyla farklı belgelerde aynı anda güncelleme yapmak mümkün.</p><p>$set operatöründen sonra sırada <strong>$unset</strong> ve <strong>upsert</strong> operatörleri var.</p><p>Bazen yapacağımız değişikler sonrasında belgeniz içinden bazı alanların tamamen silinmesini isteyebilirsiniz. İşte bu iş için $unset operatörünü kullanabiliriz.</p><p>Elimizde şöyle bir örnek olsun. Ülkelerimiz için belgelerde bir alan daha açalım ve bu da harf sayısı olsun. Detaylarda boğulmamak adına rastgele bir değer ataması yapalım ve bu değer tüm belgelerimiz için 10 olsun. Daha sonrasında ise Türkiye için bu alanı ortadan kaldıralım fakat diğer belgelerde bu alan kalmaya devam etsin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/411/1*tzG-jJmUwD4zzEOZ5pMvMg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/605/1*XQoFujVZljSZUBv83CLvWg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*kkwqgLHrt77tQObJBP_q_w.jpeg" /><figcaption><strong>$unset İşlemleri</strong></figcaption></figure><p>db.ulkebilgi.find() yazdığımızda Harf alanının sadece Türkiye belgesinde olmadığını göreceksiniz. Yalnız burada değinmem gereken bir nokta var. İlk görselde update işlemi yaparken kullandığım {} ifadesi bize şunu söylemekte. Herhangi bir koşul tanımlaması olmadığı için tüm belgeler üzerinde bu değişiklik yapılacak.</p><p>Peki aynı işlemi birden çok belgeye uygulamak istersek ?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*dkuBhPxuHIaORPvwuU4w-g.png" /><figcaption><strong>Multi $unset</strong></figcaption></figure><p>aynı şekilde db.ulkebilgi.find() komutunu yazdığınızda Harf alanının diğer belgelerden de kaldırıldığını göreceksiniz.</p><p>Peki ya upsert ?</p><p>Upserti en kısa şekilde anlatmak gerekirse şöyle bir senaryo ile bunu açıklamak uygun diye düşünüyorum. Diyelim ki belgelerimize eklemek istediğimiz bir alan var. Fakat bu alan bazı belgelerimizde varken bazılarında yok. Dolayısıyla tek tek nereye ekleyeceğiz diye kafamızın karışmaması adına upsert bizim için şunu yapar. Eğer ilgili alan belgelerde mevcutsa buralara herhangi bir ekleme yapmaz. Fakat o alanın olmadığı bir belge varsa oraya bu alanı ekler.</p><p>Şimdi Türkiye belgemize Yıl adında bir alan ekleyelim ve değerini 1923 olarak ayarlayalım. Sonrasında upsert ile diğer belgelere de aynı yıl alanını ve 1923 ü ekleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/1*p9gsC0aLAqiAHqYZvElDLA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*3qK9pHBn00C_NB3JOeTwVQ.jpeg" /><figcaption><strong>Upsert Operatörü</strong></figcaption></figure><p>Update işlemlerinde değineceğim son operatörse <strong>$inc</strong> operatörü. Bu operatör özellikle integer ifadelerde güncellemeler için daha sık kullanılmakta.</p><p>Bu operatör için örneğimizi şöyle kurgulayalım. Ülkeler için Ulkekodu adında bir alanımız vardı. Burada tanımlayacağımız koşulu sağlayan tüm ifadeler için kodumuzu arttırıp azaltalım. Koşulumuz ülke kodu 30 dan büyük olan belgeler için kodlar 10 artsın ve azalsın.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*WWIUk8Umc5aMNk8WBKQlpw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*pEOYCy5xKShBeG92Bg7N1A.jpeg" /><figcaption><strong>$inc Kullanımı</strong></figcaption></figure><p>Her iki kodu ayrı ayrı yazıp find ile belgeleri listelediğinizde Türkiye ve Almanya için değerlerin önce 10 arttığını sonra ise 10 azaldığını göreceksiniz.</p><p>CRUD işlemlerinin sonuncusu yani <strong>D</strong>elete işlemi ise remove() fonksiyonu ile gerçekleşmekte. Burada ister belirlediğimiz koşula göre ister toplu şekilde belgeleri silebiliriz.</p><p>$inc operatörü için belirlediğimiz koşulları bu sefer terse çevirelim ve ülke kodu 30 dan küçük olan belgeleri collectiondan kaldıralım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*V9VE7jVdFGJHqAQ89y33Mg.png" /><figcaption><strong>Remove İşlemi</strong></figcaption></figure><p>Peki ya collectiondaki tüm belgeleri kaldırmak istersek ? O zaman kodumuzu şu şekilde revize etmemiz gerekecek.</p><p>db.ulkebilgi.remove( {} )</p><p>Bu kodu çalıştırdığınızda ulkebilgi collectionındaki tüm belgeler silinecektir.</p><p>Yazının sonuna geldiğimize göre neler yaptığımızı kısaca bir gözden geçirmenin faydalı olacağını düşünüyorum. Öncelikle MongoDB için çalışacağımız ortamın kurulumunu ve gerekli ayarlamaları yaptık. Arkasındansa her veri tabanı sisteminin olmazsa olmazı olan CRUD işlemlerini ve update içerisinde kullanılan farklı parametreleri örneklerle anlatmaya çalıştım. Yaptığımız uygulamaların kodlarını paylaştığım github repositorysine <a href="https://github.com/laerrof/MongoDBTutorial.git">linkten</a> ulaşabilirsiniz. Son olarak ise filtreleme, sıralama ve sorgulama üzerine yazdığım bir sonraki yazıma <a href="https://medium.com/@enderkaderli/adim-adim-nosql-ve-mongodb-3-fi%CC%87ltreleme-siralama-sorgulama-ve-yardimci-operat%C3%B6rler-e14794bb3fa3">linkten</a> ulaşabilirsiniz.</p><p><strong>İletişim</strong></p><p><strong>Linkedin : Ender Kaderli</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b69646e8bf3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>