<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Joe Nyirenda</title>
    <description>The latest articles on DEV Community by Joe Nyirenda (@joe_nyirenda).</description>
    <link>https://dev.to/joe_nyirenda</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2961377%2F9a352092-d43c-4842-8a5b-484c721a19fc.png</url>
      <title>DEV Community: Joe Nyirenda</title>
      <link>https://dev.to/joe_nyirenda</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joe_nyirenda"/>
    <language>en</language>
    <item>
      <title>Optimizing MongoDB Atlas Search Indexes with Views</title>
      <dc:creator>Joe Nyirenda</dc:creator>
      <pubDate>Sun, 23 Mar 2025 19:05:04 +0000</pubDate>
      <link>https://dev.to/joe_nyirenda/optimizing-atlas-search-indexes-with-views-4ogp</link>
      <guid>https://dev.to/joe_nyirenda/optimizing-atlas-search-indexes-with-views-4ogp</guid>
      <description>&lt;p&gt;MongoDB Atlas now enables the use of views to transform documents and filter collections for search purposes. By creating a view with a specific aggregation pipeline, you can reshape documents, apply filters, and then create search indexes on this transformed data whilst making your search indexes smaller and laser-focused.​&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/b27EpG-b0gQ"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  Steps to Create a View for Atlas Search:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Define the Aggregation Pipeline: Specify the stages to transform and filter the documents as needed.​&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create the View: Use the aggregation pipeline to define a view that presents the transformed data.​&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Create a Search Index on the View: Once the view is established, you can create a search index on it to facilitate efficient search operations.​&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This approach allows for a flexible and powerful way to tailor your search functionality to specific application requirements.​&lt;/p&gt;

&lt;h3&gt;
  
  
  Benefits of Using Views for Atlas Search
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Customized Data Representation: Views allow you to present data in a format that aligns with your application's search requirements.​&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Efficient Search Operations: By filtering and transforming data at the view level, you can optimize search performance and resource utilization.​&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Simplified Index Management: Creating search indexes on views can reduce the complexity of managing multiple indexes on the base collection.​&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Utilizing views to transform documents and filter collections in MongoDB Atlas Search provides a strategic advantage in optimizing search performance and resource utilization. By focusing indexes on pertinent subsets of data and leveraging views for document transformation, developers can craft efficient, cost-effective, and precise search functionalities tailored to their application's needs.​&lt;/p&gt;

&lt;p&gt;Embracing these features lets you build robust applications that deliver swift and accurate search experiences.&lt;/p&gt;

</description>
      <category>mongodb</category>
      <category>mongodbatlassearch</category>
      <category>mongodbviews</category>
      <category>lucene</category>
    </item>
    <item>
      <title>Automate MongoDB Atlas Deployment with Terraform</title>
      <dc:creator>Joe Nyirenda</dc:creator>
      <pubDate>Sun, 23 Mar 2025 18:34:29 +0000</pubDate>
      <link>https://dev.to/joe_nyirenda/automate-mongodb-atlas-deployment-with-terraform-1k02</link>
      <guid>https://dev.to/joe_nyirenda/automate-mongodb-atlas-deployment-with-terraform-1k02</guid>
      <description>&lt;p&gt;If you're working with MongoDB Atlas and looking to scale or standardize deployments across environments, Terraform is your friend.&lt;/p&gt;

&lt;p&gt;In this video , I’ll walk you through how to automate your MongoDB Atlas deployments using Terraform—so you can spend less time in the UI and more time building.&lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/j0rAupxipNE"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Terraform?
&lt;/h2&gt;

&lt;p&gt;Terraform lets you define and provision infrastructure using code. With the official MongoDB Atlas provider, you can version, audit, and reuse your configurations. That means faster, safer, and repeatable deployments—especially helpful when working in teams or managing multiple environments.&lt;/p&gt;

&lt;h2&gt;
  
  
  What You’ll Need
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A MongoDB Atlas account&lt;/li&gt;
&lt;li&gt;An organization/project API key with the right roles&lt;/li&gt;
&lt;li&gt;Terraform installed locally&lt;/li&gt;
&lt;li&gt;A basic understanding of HCL (HashiCorp Configuration Language)
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="err"&gt;provider&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mongodbatlas"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;public_key&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;var.mongodb_atlas_public_key&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;private_key&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;var.mongodb_atlas_private_key&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;resource&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mongodbatlas_project"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"project"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;name&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"my-terraform-project"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;org_id&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;var.mongodb_atlas_org_id&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;resource&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mongodbatlas_cluster"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"cluster"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;project_id&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;mongodbatlas_project.project.id&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;name&lt;/span&gt;&lt;span class="w"&gt;         &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"my-cluster"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;provider_name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AWS"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;region_name&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"US_EAST_1"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;cluster_type&lt;/span&gt;&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"REPLICASET"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;backing_provider_name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"AWS"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;auto_scaling_disk_gb_enabled&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;mongo_db_major_version&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"6.0"&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="err"&gt;provider_instance_size_name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"M10"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add variables and &lt;code&gt;terraform.tfvars&lt;/code&gt; as needed. Then run the following commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;terraform init
terraform validate
terraform plan
terraform apply -auto-approve
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Automating MongoDB Atlas deployment with Terraform helps reduce human error and improves repeatability. Whether you're deploying one cluster or dozens, this approach scales with you.&lt;/p&gt;

&lt;p&gt;Let me know what else you would like to automate in MongoDB Atlas.&lt;/p&gt;

&lt;p&gt;Happy building!&lt;/p&gt;

</description>
      <category>terraform</category>
      <category>mongodb</category>
      <category>automation</category>
      <category>infrastructureascode</category>
    </item>
  </channel>
</rss>
