<?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: rachelle palmer</title>
    <description>The latest articles on DEV Community by rachelle palmer (@techbelle).</description>
    <link>https://dev.to/techbelle</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%2F474091%2F4dcf2547-99ff-4d57-8f08-1b9df342c2f2.jpg</url>
      <title>DEV Community: rachelle palmer</title>
      <link>https://dev.to/techbelle</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/techbelle"/>
    <language>en</language>
    <item>
      <title>Supercharging Time Series Collections: Key Enhancements in MongoDB 8.0 with Block Processing</title>
      <dc:creator>rachelle palmer</dc:creator>
      <pubDate>Fri, 04 Oct 2024 20:29:03 +0000</pubDate>
      <link>https://dev.to/mongodb/supercharging-time-series-collections-key-enhancements-in-mongodb-80-with-block-processing-5b3i</link>
      <guid>https://dev.to/mongodb/supercharging-time-series-collections-key-enhancements-in-mongodb-80-with-block-processing-5b3i</guid>
      <description>&lt;p&gt;The landscape for time-series data has evolved significantly in recent years. Businesses are capturing more granular data, recognizing that the value of data rises in proportion with its precision. Storing time-stamped data and performing temporal analytics is becoming essential, even mandated across industries. As data volumes inevitably grow and precision-based analytics become increasingly crucial, tools that provide efficient ways to work with time-series data will become even more critical.&lt;/p&gt;

&lt;p&gt;To address the rising demand for time-series analytics, we introduced Time Series Collections in MongoDB 5.0, designed to meet the expanding needs of time-stamped data. Unlike point solutions that require separate complex setups, MongoDB’s Time Series Collection enables users to simply stand up a collection and instantly leverage time-series capabilities. Over time, we’ve expanded its capabilities with features like columnar compression, enhanced temporal analytics, enriched indexing, geo-support, and seamless integration with the broader MongoDB portfolio—creating a streamlined, developer-friendly experience.&lt;/p&gt;

&lt;p&gt;In our upcoming 8.0 release, we’re excited to introduce new features that significantly enhance scalability and query performance for managing large time-series workloads, delivering even better price-performance for our users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Enhanced Time Series Scalability Improvements
&lt;/h2&gt;

&lt;p&gt;As time-series data volumes grow, the challenge isn't just about scaling, it's about doing so efficiently, balancing resources, cost, and performance. With MongoDB 8.0, we’re introducing key optimizations in Time Series Collections to help users maximize resource value while managing increasingly complex workloads.&lt;/p&gt;

&lt;p&gt;In previous versions, Time Series Collections inserted data in an uncompressed format, causing a larger working set, increased cache use, and write amplification, leading to high I/O as uncompressed data was written to the WiredTiger storage engine. This was especially problematic for high-cardinality workloads with millions of devices, sensors etc. With MongoDB 8.0, Time Series Collections now directly write into a column-compressed format, reducing cache usage, lowering write I/O, improving insert performance and storage efficiency.&lt;/p&gt;

&lt;p&gt;For users, the benefits of lower cache usage directly translates into cost savings. Users will be able to extract a lot more value from their existing cluster resources resulting in better price-performance. We’ve observed throughput improvements of 2-3x, with cache usage reduced by 10-20x compared to workloads on version 7.0.&lt;br&gt;
For example, workload on MongoDB 7.0 can experience performance fluctuations, leading to inconsistent write performance and a sawtooth pattern caused by I/O overload. Writing large amounts of uncompressed data to disk strained checkpoints. As shown below, a test on a 7.0 Atlas M50 (RAM - 32GB, Storage 160GB, 8 vCPUs) cluster reached peaks of 500K inserts/s while displaying this pattern:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1kf5qd3kkjuapqpr1p45.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1kf5qd3kkjuapqpr1p45.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With 8.0, the write performance is now steady eliminating I/O strain. As shown below, the same workload on Atlas M50 achieves a stable 600K inserts/s, eliminating the previous sawtooth pattern.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frk3ukil4un00ad2ydckm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frk3ukil4un00ad2ydckm.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Block Processing with Time Series Collections&lt;a href="https://dev.tomi"&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;User engagement highlighted that query performance is crucial as time-series workloads scale. Traditionally, the MongoDB query engine processes data one document at a time, which can be inefficient for large-scale analytics. For Time Series Collections, this inefficiency is due to the need to unpack and reshape a large volume of compressed data. To address this, we introduced Block Processing for Time Series Collections – a new automatic query execution model that processes "blocks of data" at once, leveraging column-level summaries while avoiding the overhead of unpacking and reshaping documents. This approach significantly improves performance, particularly for aggregation that leverage stages such as $match, $sort, $group and other analytical stages like $setWindowFields. &lt;/p&gt;

&lt;p&gt;By making each step more efficient, the overall impact becomes exponential, reducing overhead and leveraging time-series data patterns previously unavailable. Each aggregation stage processes larger data chunks, leading to a more efficient query execution model with significantly faster performance. Use cases like financial analysis and IoT, which involve intensive filtering, grouping, and sorting (i.e $match, $group, $sort), will see major performance improvements. With Block Processing, we've observed improvements ranging from 10-40x, with some large-scale aggregations reaching up to 100x.&lt;/p&gt;

&lt;p&gt;Let’s explore how Block Processing can optimize common financial aggregations, such as generating OHLC (Open, High, Low, Close) and calculating an exponential moving average over a specified time period. In this example, we analyze an aggregation that saw a 20x improvement on an Atlas M50 replica set using MongoDB's fork of &lt;a href="https://github.com/mongodb-forks/tsbs" rel="noopener noreferrer"&gt;TSBS&lt;/a&gt; (time-series benchmarking suite). We use the TSBS finance use case that generates a workload containing 10 stock symbols, each creating an event per second over 7 days, resulting in approximately 6 million events loaded into a Time Series collection.&lt;/p&gt;

&lt;p&gt;Here's a sample document so you can see what this looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "time" : ISODate("2022-01-01T00:00:00Z"),
  "tags" : {
    "symbol" : "MDB"
  },
  "_id" : ObjectId("64c4092a9451cd8064c69be1"),
  "measurement" : "price", 
  "price" : 200.13171
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We start by creating a time-series collection &lt;code&gt;market_data&lt;/code&gt; in MongoDB, where the &lt;code&gt;timeField&lt;/code&gt; is set to time, and metaField to tags. The granularity is set to "seconds" to capture financial data at a 1-minute interval.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;db.createCollection("market_data", {
  timeseries: {
    timeField: "time",
    metaField: "tags",
    granularity: "seconds"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Index:&lt;/strong&gt;&lt;br&gt;
We create two compound indexes to support queries within the workload:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;db.market_data.createIndex({ "tags": 1, "time": 1 }); 
db.market_data.createIndex({ "tags.symbol": 1, "time": -1 });
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Query:&lt;/strong&gt;&lt;br&gt;
Next, we construct a query to generate the OHLC and exponential moving average for a group of stock symbols computed every 4 hours over a 1 day time window.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;db.market_data.aggregate([
  {"$match": {"$expr": {"$gte": ["$time", {"$dateSubtract": {"startDate": new Date("2022-01-01T03:00:00Z"), "unit": "hour", "amount": 24}}]}}},
  {"$sort": {"time": 1}},
  {"$group": {
    "_id": {"symbol": "$tags.symbol", "time": {"$dateTrunc": {"date": "$time", "unit": "minute", "binSize": 240}}}, 
    "high": {"$max": "$price"},
    "low": {"$min": "$price"},
    "open": {"$first": "$price"},
    "close": {"$last": "$price"}
  }},
  {"$setWindowFields": {
    "partitionBy": "$_id.symbol",
    "sortBy": {"_id.time": 1},
    "output": {"expMovingAverage": {"$expMovingAvg": {"input": "$close", "N": 100}}}
  }},
  {"$sort": {"_id.time": -1}}
]);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Sample Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "_id": { "symbol": "MDB", "time": ISODate("2022-01-01T02:00:00Z") },
  "high": 148.27729312597552,
  "low": 51.01901106672195,
  "open": 126.83590008130241,
  "close": 99.44471233463418,
  "expMovingAverage": 99.44471233463418
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compared to 7.0, this query saw its operations per second improve by an incredible 2000%, or 20x. This dramatic boost reflects our ongoing commitment to helping MongoDB users handle complex time-series data with ease, and we’re excited to see what can be achieved with these new enhancements.&lt;/p&gt;

&lt;p&gt;Please try it out, and let us know your feedback!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;contributed by Nishith Atreya and Michael Gargiulo&lt;/em&gt;&lt;/p&gt;

</description>
      <category>mongodb</category>
      <category>performance</category>
      <category>timeseries</category>
    </item>
    <item>
      <title>How to retrieve Github Repository Data using Python</title>
      <dc:creator>rachelle palmer</dc:creator>
      <pubDate>Sat, 28 Sep 2024 17:21:08 +0000</pubDate>
      <link>https://dev.to/techbelle/how-to-retrieve-github-repository-data-using-python-59g3</link>
      <guid>https://dev.to/techbelle/how-to-retrieve-github-repository-data-using-python-59g3</guid>
      <description>&lt;p&gt;Does your organization have (way) too many github repositories, and you need an easy way to summarize and keep record of what each one is for reporting, dashboard, or auditing purposes? Here's a quick script to do that very thing using the Github API. &lt;/p&gt;

&lt;h3&gt;
  
  
  Functions:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;get_repo_info(owner, repo)&lt;/code&gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes a GitHub repository owner's username (&lt;code&gt;owner&lt;/code&gt;) and repository name (&lt;code&gt;repo&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Sends a request to GitHub's API to get repository information.&lt;/li&gt;
&lt;li&gt;Returns the repository's information as a JSON object if successful, or &lt;code&gt;None&lt;/code&gt; if there is an error.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;get_collaborators(collaborators_url)&lt;/code&gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes the URL to the list of collaborators for a repository.&lt;/li&gt;
&lt;li&gt;Sends a request to fetch the list of collaborators.&lt;/li&gt;
&lt;li&gt;Returns a list of collaborator usernames, or an empty list if an error occurs.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;get_languages(languages_url)&lt;/code&gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes the URL to the repository's languages data.&lt;/li&gt;
&lt;li&gt;Sends a request to retrieve the programming languages used in the repository.&lt;/li&gt;
&lt;li&gt;Returns a list of languages, or an empty list if there is an error.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;get_open_issues(owner, repo)&lt;/code&gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes the repository owner's username (&lt;code&gt;owner&lt;/code&gt;) and repository name (&lt;code&gt;repo&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Sends a request to retrieve the list of open issues in the repository.&lt;/li&gt;
&lt;li&gt;Returns the open issues in JSON format, or prints an error message if there's a problem.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;code&gt;get_repo_data(repo_url)&lt;/code&gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Takes a repository URL, parses it to get the &lt;code&gt;owner&lt;/code&gt; and &lt;code&gt;repo&lt;/code&gt; values, and then calls the other functions to gather various information about the repository.&lt;/li&gt;
&lt;li&gt;Compiles the repository information, including its name, owner, visibility, collaborators, languages, open issues, and last activity, and returns it in a structured format (a dictionary).
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import json
import requests
from pymongo import MongoClient

# MongoDB setup (replace with your actual connection details)
client = MongoClient("mongodb://localhost:27017/")
db = client["github_repos"]  # Database name
collection = db["repos"]     # Collection name

def get_repo_info(owner, repo):
    url = f"https://api.github.com/repos/{owner}/{repo}"
    headers = {"Accept": "application/vnd.github+json"}
    response = requests.get(url, headers=headers)
    if response.status_code == 200:
        return response.json()
    else:
        print(f"Error: {response.status_code}")
        return None

def get_collaborators(collaborators_url):
    response = requests.get(collaborators_url)
    if response.status_code == 200:
        return [collaborator["login"] for collaborator in response.json()]
    else:
        return []

def get_languages(languages_url):
    response = requests.get(languages_url)
    if response.status_code == 200:
        return list(response.json().keys())
    else:
        return []

def get_open_issues(owner, repo):
    url = f"https://api.github.com/repos/{owner}/{repo}/issues?state=open"
    headers = {"Accept": "application/vnd.github+json"}
    response = requests.get(url, headers=headers)
    if response.status_code == 200:
        return response.json()
    else:
        print(f"Error: {response.status_code}")
        return []

def get_repo_data(repo_url):
    owner, repo = repo_url.split("/")[-2:]
    repo_info = get_repo_info(owner, repo)

    if repo_info:
        data = {
            "Github URL": repo_url,
            "Project name": repo_info["name"],
            "Project owner": repo_info["owner"]["login"],
            "List users with access": get_collaborators(repo_info["collaborators_url"].split("{")[0]),  # remove template part of URL
            "Programming languages used": get_languages(repo_info["languages_url"]),
            "Security/visibility level": repo_info["visibility"],
            "Summary": repo_info["description"],
            "Last maintained": repo_info["pushed_at"],
            "Last release": repo_info["default_branch"],
            "Open issues": get_open_issues(owner, repo),
        }

        # Insert the data into MongoDB
        collection.insert_one(data)
        print("Data inserted into MongoDB successfully.")

        return data
    else:
        return None

# Example usage
repo_url = "https://github.com/URL"
repo_data = get_repo_data(repo_url)

if repo_data:
    print(json.dumps(repo_data, indent=4))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>github</category>
      <category>python</category>
    </item>
    <item>
      <title>Using ASP.NET Core OData with MongoDB Atlas</title>
      <dc:creator>rachelle palmer</dc:creator>
      <pubDate>Fri, 24 May 2024 00:42:35 +0000</pubDate>
      <link>https://dev.to/mongodb/using-aspnet-core-odata-with-mongodb-atlas-380e</link>
      <guid>https://dev.to/mongodb/using-aspnet-core-odata-with-mongodb-atlas-380e</guid>
      <description>&lt;h1&gt;
  
  
  Overview
&lt;/h1&gt;

&lt;p&gt;This article focuses on how you can quickly get up and running using Microsoft's ASP.NET Core OData extension with MongoDB Atlas. &lt;/p&gt;

&lt;p&gt;OData stands for &lt;a href="https://www.odata.org/" rel="noopener noreferrer"&gt;Open Data Protocol&lt;/a&gt; which is a standard that allows developers to simplify the process of building and consuming RESTful APIs. &lt;a href="https://www.mongodb.com/docs/atlas/" rel="noopener noreferrer"&gt;MongoDB Atlas&lt;/a&gt; is MongoDB's cloud offering that allows you to leverage the full potential of MongoDB's developer data platform without any cloud vendor lock-in. &lt;/p&gt;

&lt;h1&gt;
  
  
  Tutorial
&lt;/h1&gt;

&lt;p&gt;You need to have a MongoDB Atlas Cluster set up with sample data loaded as shown &lt;a href="https://www.mongodb.com/docs/atlas/getting-started/" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I'm using Visual Studio 2022 Community Edition in this tutorial. You can choose to use any IDE of your choice. Open up a new project and choose the ASP.NET Core Empty Project template.&lt;br&gt;
    &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe6dujbgypsln1wimmi03.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fe6dujbgypsln1wimmi03.png" alt="VS ASP.NET Core Empty Project"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On the following screen, name your project and click Next. Choose the latest LTS .NET Framework and make sure to disable the 'Configure for HTTPS checkbox.&lt;br&gt;&lt;br&gt;
    &lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnq9mjh8ccpqq0eoon0hm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fnq9mjh8ccpqq0eoon0hm.png" alt="Configure for LTS"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we are going to add the &lt;a href="https://www.nuget.org/packages/MongoDB.AspNetCore.OData/#readme-body-tab" rel="noopener noreferrer"&gt;MongoDB OData extension&lt;/a&gt; from the Nuget package manager as seen below. This uses the MongoDB .NET/C# Driver and Microsoft's &lt;code&gt;AspNetCore.OData&lt;/code&gt; package as its dependencies. &lt;/p&gt;

&lt;p&gt;I'm going to use the &lt;code&gt;sample_restaurants&lt;/code&gt; database from the &lt;a href="https://www.mongodb.com/docs/atlas/sample-data/sample-restaurants/" rel="noopener noreferrer"&gt;sample restaurants dataset&lt;/a&gt; loaded into my MongoDB Atlas cluster. We need some model classes as shown below in our project for this. &lt;br&gt;
First we'll create the &lt;code&gt;Restaurant&lt;/code&gt; class.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 csharp
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;

namespace ODataTutorial.Models
{
    [BsonIgnoreExtraElements]
    public class Restaurant
    {
        [BsonRepresentation(BsonType.ObjectId)]
        public string Id { get; set; }

        [BsonElement("name")]
        public string Name { get; set; }

        [BsonElement("restaurant_id")]
        public string? RestaurantId { get; set; }

        [BsonElement("cuisine")]
        public string Cuisine { get; set; }

        [BsonElement("address")]
        public Address Address { get; set; }

        [BsonElement("borough")]
        public string Borough { get; set; }
    }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Next we’ll create the &lt;code&gt;Address&lt;/code&gt; model class. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 csharp
using MongoDB.Bson.Serialization.Attributes;

namespace ODataTutorial.Models
{
    public class Address

  {
        [BsonElement("building")]
        public string Building { get; set; }

        [BsonElement("coord")]
        public double[] Coordinates { get; set; }

        [BsonElement("street")]
        public string Street { get; set; }

        [BsonElement("zipcode")]
        public string ZipCode { get; set; }
    }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The &lt;code&gt;Address&lt;/code&gt; class does not require an &lt;code&gt;_id&lt;/code&gt; because it is only stored as a nested subdocument.&lt;/p&gt;

&lt;p&gt;Note that we are using the &lt;code&gt;[BsonElement]&lt;/code&gt; &lt;a href="https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/attributes" rel="noopener noreferrer"&gt;attribute&lt;/a&gt; to tell the MongoDB C# driver to map the names in our model classes to the field names in the database. You could also choose to use a &lt;a href="https://www.mongodb.com/docs/drivers/csharp/upcoming/fundamentals/serialization/poco/#set-field-names" rel="noopener noreferrer"&gt;convention pack&lt;/a&gt; to do the same.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;[BsonIgnoreExtraElements]&lt;/code&gt; tells the driver to ignore other fields in the database like 'grades' so that it doesn't throw an error when deserializing such fields. You can read more about serialization using the MongoDB C# driver &lt;a href="https://www.mongodb.com/docs/drivers/csharp/current/fundamentals/serialization/poco/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;We need the &lt;code&gt;[BsonRepresentation(BsonType.ObjectId)]&lt;/code&gt; attribute to tell the Driver that the Id is represented as a string in our model class but as an ObjectId in the database. &lt;/p&gt;

&lt;p&gt;Now we'll create a simple Controller that inherits from &lt;a href="https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnet.odata.odatacontroller" rel="noopener noreferrer"&gt;ODataController&lt;/a&gt; and has a Get action with the &lt;code&gt;[MongoEnableQuery]&lt;/code&gt; attribute. This enables the use of URI query options in our API calls.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 csharp 
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.OData.Routing.Controllers;
using MongoDB.AspNetCore.OData;
using MongoDB.Driver;
using ODataTutorial.Models;

namespace ODataTutorial.Controllers
{
    public class RestaurantsController : ODataController
    {
        private readonly IMongoCollection&amp;lt;Restaurant&amp;gt; _restaurants;

        public RestaurantsController(IMongoClient mongoClient)
        {
            var database = 
mongoClient.GetDatabase("sample_restaurants");
            _restaurants = database.GetCollection&amp;lt;Restaurant&amp;gt; 
("restaurants");
        }

        [MongoEnableQuery]
        public ActionResult Get()
        {
            return Ok(_restaurants.AsQueryable());
        }
    }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Our &lt;code&gt;Program.cs&lt;/code&gt; file which is the entry point of this Web Application will be quite simple and we will use the &lt;code&gt;Startup.cs&lt;/code&gt; file to connect to our database and set up the &lt;a href="https://learn.microsoft.com/en-us/odata/webapi/model-builder-abstract" rel="noopener noreferrer"&gt;Model Builder&lt;/a&gt;.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 csharp
using ODataTutorial;

public class Program
{
    public static void Main(string[] args)
    {
        var app = CreateHostBuilder(args).Build();
        app.Run();
    }

    public static IHostBuilder CreateHostBuilder(string[] args) =&amp;gt;
        Host.CreateDefaultBuilder(args)
            .ConfigureWebHostDefaults(webBuilder =&amp;gt; 
            {
                webBuilder.UseStartup&amp;lt;Startup&amp;gt;();
            });
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;While setting up the modelBuilder we need to tell it to use our &lt;code&gt;Id&lt;/code&gt; field as the primary key instead of the &lt;code&gt;RestaurantID&lt;/code&gt; and this is done through &lt;code&gt;model.HasKey(e =&amp;gt; e.Id)&lt;/code&gt; &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 csharp
using Microsoft.AspNetCore.OData;
using Microsoft.OData.ModelBuilder;
using MongoDB.Driver;
using ODataTutorial.Models;

namespace ODataTutorial
{
    public class Startup
    {
        public IConfiguration Configuration { get; }
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public void ConfigureServices(IServiceCollection services) 
        {
            var connectionString = Configuration.GetSection("MongoDB").GetValue&amp;lt;string&amp;gt;("Uri");
            if (string.IsNullOrEmpty(connectionString))
            {
                throw new InvalidOperationException("Cannot read MongoDB connection settings");
            }

            services.AddSingleton&amp;lt;IMongoClient&amp;gt;(new MongoClient(connectionString));

            var modelBuilder = new ODataConventionModelBuilder();
            var model = modelBuilder.EntitySet&amp;lt;Restaurant&amp;gt;("Restaurants").EntityType;
            model.HasKey(e =&amp;gt; e.Id);

            services.AddControllers().AddOData(
            options =&amp;gt;
            {
                options.Select().Filter().OrderBy().Expand().Count().SetMaxTop(1000).AddRouteComponents(
                    "odata",
                    modelBuilder.GetEdmModel());
            });
        }

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseRouting();
            app.UseEndpoints(endpoints =&amp;gt;
            {
                endpoints.MapControllers();
            });
        }
    }
}



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Lastly, we need to make sure we add our MongoDB Atlas connection URL in our &lt;code&gt;appsettings.json&lt;/code&gt; file as seen below&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 json
  "MongoDB": {
    "Uri": "&amp;lt;Enter MongoDB Atlas Connection URL here&amp;gt;"
  },


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Voila! That's it, we are now ready to test our OData endpoints with MongoDB Atlas. &lt;/p&gt;

&lt;h1&gt;
  
  
  Testing
&lt;/h1&gt;

&lt;p&gt;Once you hit Build and let our application run, you should see it fire up in your chosen browser. We are using a browser in this example but we could use other tools like Postman to test the same. &lt;/p&gt;

&lt;p&gt;The default endpoint based on the port configured (E.g &lt;code&gt;http://localhost:5279/&lt;/code&gt; in my project. Please note that this port will be randomly generated when creating a new project) will not show anything since we don't have it configured. However once you change it to &lt;code&gt;http://localhost:5279/odata/&lt;/code&gt;, you should see a response like this &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 json
{
  "@odata.context": "http://localhost:5279/odata/$metadata",
  "value": [
    {
      "name": "Restaurants",
      "kind": "EntitySet",
      "url": "Restaurants"
    }
  ]
} 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can also see the metadata of our data model by going to &lt;code&gt;http://localhost:5279/odata/$metadata&lt;/code&gt; Note that our &lt;code&gt;Id&lt;/code&gt; field is shown as the Key as intended. &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 XML
&amp;lt;edmx:Edmx xmlns:edmx="http://docs.oasis-open.org/odata/ns/edmx" Version="4.0"&amp;gt;
&amp;lt;edmx:DataServices&amp;gt;
  &amp;lt;Schema
    xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="ODataTutorial.Models"&amp;gt;
    &amp;lt;EntityType Name="Restaurant"&amp;gt;
      &amp;lt;Key&amp;gt;
        &amp;lt;PropertyRef Name="Id"/&amp;gt;
      &amp;lt;/Key&amp;gt;
      &amp;lt;Property Name="Id" Type="Edm.String" Nullable="false"/&amp;gt;
      &amp;lt;Property Name="Name" Type="Edm.String" Nullable="false"/&amp;gt;
      &amp;lt;Property Name="RestaurantId" Type="Edm.String"/&amp;gt;
      &amp;lt;Property Name="Cuisine" Type="Edm.String" Nullable="false"/&amp;gt;
      &amp;lt;Property Name="Address" Type="ODataTutorial.Models.Address" Nullable="false"/&amp;gt;
      &amp;lt;Property Name="Borough" Type="Edm.String" Nullable="false"/&amp;gt;
    &amp;lt;/EntityType&amp;gt;
    &amp;lt;ComplexType Name="Address"&amp;gt;
      &amp;lt;Property Name="Building" Type="Edm.String" Nullable="false"/&amp;gt;
      &amp;lt;Property Name="Coordinates" Type="Collection(Edm.Double)" Nullable="false"/&amp;gt;
      &amp;lt;Property Name="Street" Type="Edm.String" Nullable="false"/&amp;gt;
      &amp;lt;Property Name="ZipCode" Type="Edm.String" Nullable="false"/&amp;gt;
    &amp;lt;/ComplexType&amp;gt;
  &amp;lt;/Schema&amp;gt;
  &amp;lt;Schema
    xmlns="http://docs.oasis-open.org/odata/ns/edm" Namespace="Default"&amp;gt;
    &amp;lt;EntityContainer Name="Container"&amp;gt;
      &amp;lt;EntitySet Name="Restaurants" EntityType="ODataTutorial.Models.Restaurant"/&amp;gt;
    &amp;lt;/EntityContainer&amp;gt;
  &amp;lt;/Schema&amp;gt;
&amp;lt;/edmx:DataServices&amp;gt;
&amp;lt;/edmx:Edmx&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Now let's try to fetch data with some queries. We'll only see the first 1000 restaurants since we had &lt;code&gt;SetMaxTop(1000)&lt;/code&gt; in our &lt;code&gt;Startup.cs&lt;/code&gt; file. You can change this as needed. If we go to the endpoint &lt;code&gt;http://localhost:5279/odata/Restaurants&lt;/code&gt;, we should be able to see our list of Restaurants.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 json
{
"@odata.context": "http://localhost:5279/odata/$metadata#Restaurants",
"value": [
  {
    "Id": "5eb3d668b31de5d588f42930",
    "Name": "Brunos On The Boulevard",
    "RestaurantId": "40356151",
    "Cuisine": "American",
    "Borough": "Queens",
    "Address": {
      "Building": "8825",
      "Coordinates": [ -73.8803827, 40.7643124 ],
      "Street": "Astoria Boulevard",
      "ZipCode": "11369"
    }
  },
  {
    "Id": "5eb3d668b31de5d588f42932",
    "Name": "Taste The Tropics Ice Cream",
    "RestaurantId": "40356731",
    "Cuisine": "Ice Cream, Gelato, Yogurt, Ices",
    "Borough": "Brooklyn",
    "Address": {
      "Building": "1839",
      "Coordinates": [ -73.9482609, 40.6408271 ],
      "Street": "Nostrand Avenue",
      "ZipCode": "11226"
    }
  },
  {
    "Id": "5eb3d668b31de5d588f42934",
    "Name": "C &amp;amp; C Catering Service",
    "RestaurantId": "40357437",
    "Cuisine": "American",
    "Borough": "Brooklyn",
    "Address": {
      "Building": "7715",
      "Coordinates": [ -73.9973325, 40.6117489 ],
      "Street": "18 Avenue",
      "ZipCode": "11214"
    }
  },
  .
  .
  .
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Let's try to play around with some filters. This will allow us to query data without any additional logic in our application. We can search for all Italian restaurants using &lt;code&gt;http://localhost:5279/odata/Restaurants?$filter=Cuisine eq 'Italian'&lt;/code&gt; or even better, we can search for all Italian restaurants in Queens by &lt;code&gt;http://localhost:5279/odata/Restaurants?$filter=Cuisine eq 'Italian' and Borough eq 'Queens'&lt;/code&gt; This should give us all the restaurants satisfying that query filter.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
 json
{
"@odata.context": "http://localhost:5279/odata/$metadata#Restaurants",
"value": [
  {
    "Id": "5eb3d668b31de5d588f429ed",
    "Name": "Piccola Venezia",
    "RestaurantId": "40367540",
    "Cuisine": "Italian",
    "Borough": "Queens",
    "Address": {
      "Building": "42-01",
      "Coordinates": [ -73.911784, 40.764766 ],
      "Street": "28 Avenue",
      "ZipCode": "11103"
    }
  },
  {
    "Id": "5eb3d668b31de5d588f429b8",
    "Name": "Don Peppe",
    "RestaurantId": "40366230",
    "Cuisine": "Italian",
    "Borough": "Queens",
    "Address": {
      "Building": "13558",
      "Coordinates": [ -73.8216767, 40.6689548 ],
      "Street": "Lefferts Boulevard",
      "ZipCode": "11420"
    }
  },
  {
    "Id": "5eb3d668b31de5d588f429cc",
    "Name": "Cara Mia",
    "RestaurantId": "40366812",
    "Cuisine": "Italian",
    "Borough": "Queens",
    "Address": {
      "Building": "220-20",
      "Coordinates": [ -73.7429218, 40.7305714 ],
      "Street": "Hillside Avenue",
      "ZipCode": "11427"
    }
  },
  {
    "Id": "5eb3d668b31de5d588f42a7e",
    "Name": "Aunt Bella'S Rest Of Little Neck",
    "RestaurantId": "40371807",
    "Cuisine": "Italian",
    "Borough": "Queens",
    "Address": {
      "Building": "4619",
      "Coordinates": [ -73.7363139, 40.767005 ],
      "Street": "Marathon Parkway",
      "ZipCode": "11362"
    }
  },
  .
  .
  .
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;If we only want to see selected fields, we can use the select filter as follows &lt;code&gt;http://localhost:5279/odata/Restaurants?$select=Name&lt;/code&gt;&lt;/p&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&lt;br&gt;
 json&lt;br&gt;
{&lt;br&gt;
"@odata.context": "&lt;a href="http://localhost:5279/odata/$metadata#Restaurants(Name)" rel="noopener noreferrer"&gt;http://localhost:5279/odata/$metadata#Restaurants(Name)&lt;/a&gt;",&lt;br&gt;
"value": [&lt;br&gt;
  {&lt;br&gt;
    "Name": "Brunos On The Boulevard"&lt;br&gt;
  },&lt;br&gt;
  {&lt;br&gt;
    "Name": "Taste The Tropics Ice Cream"&lt;br&gt;
  },&lt;br&gt;
  {&lt;br&gt;
    "Name": "C &amp;amp; C Catering Service"&lt;br&gt;
  },&lt;br&gt;
  {&lt;br&gt;
    "Name": "Carvel Ice Cream"&lt;br&gt;
  },&lt;br&gt;
  .&lt;br&gt;
  .&lt;br&gt;
  .&lt;br&gt;
} 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h1&gt;
&lt;br&gt;
  &lt;br&gt;
  &lt;br&gt;
  Conclusion&lt;br&gt;
&lt;/h1&gt;

&lt;p&gt;The full list of queries supported by OData can be seen &lt;a href="https://www.odata.org/getting-started/basic-tutorial/" rel="noopener noreferrer"&gt;here&lt;/a&gt;. For more query options, you can refer &lt;a href="https://learn.microsoft.com/en-us/odata/concepts/queryoptions-overview" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The OData protocol makes it simple to power your REST APIs but it may have some disadvantages like lack of control over what user's are trying to access and difficulties in optimizing specific queries which should be considered before deciding whether that suits your architectural needs.&lt;/p&gt;

&lt;p&gt;We were able to quickly get up and running with a project that uses the &lt;a href="https://www.nuget.org/packages/MongoDB.AspNetCore.OData/" rel="noopener noreferrer"&gt;MongoDB extension for OData&lt;/a&gt; with MongoDB Atlas. You can use the OData provider too to power you REST based applications. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are you using odata with MongoDB? We want to hear from you! please look me up on linkedin and reach out!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This article contributed by &lt;a href="https://www.linkedin.com/in/rishit-bhatia-65ba5437/" rel="noopener noreferrer"&gt;Rishit Bhatia&lt;/a&gt; and &lt;a href="https://www.linkedin.com/in/rachellepalmer/" rel="noopener noreferrer"&gt;Rachelle Palmer&lt;/a&gt; from MongoDB&lt;/em&gt;&lt;/p&gt;

</description>
      <category>odata</category>
      <category>dotnetcore</category>
      <category>webapi</category>
      <category>csharp</category>
    </item>
    <item>
      <title>Fast track your FastAPI implementation and eliminate boilerplate</title>
      <dc:creator>rachelle palmer</dc:creator>
      <pubDate>Wed, 14 Feb 2024 17:03:56 +0000</pubDate>
      <link>https://dev.to/mongodb/fast-track-your-fastapi-implementation-and-eliminate-boilerplate-36ck</link>
      <guid>https://dev.to/mongodb/fast-track-your-fastapi-implementation-and-eliminate-boilerplate-36ck</guid>
      <description>&lt;p&gt;ICYMI: MongoDB has released a new Full Stack FastAPI, React, MongoDB (FARM) base application generator for Python webdev.&lt;/p&gt;

&lt;p&gt;It has always been easy and quick to start building modern web applications with MongoDB and FastAPI. But we still had to make many decisions about other parts of the stack, such as authentication, testing, integration etc., and manually integrate these components.&lt;/p&gt;

&lt;p&gt;The &lt;a href="https://github.com/mongodb-labs/full-stack-fastapi-mongodb" rel="noopener noreferrer"&gt;MongoDB FastAPI app generator&lt;/a&gt; simplifies this process further via:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Docker Compose Integration&lt;/li&gt;
&lt;li&gt;Built-in Authentication System: Includes user management schemas, models, CRUD, and APIs, with OAuth2 JWT token support and magic link authentication.&lt;/li&gt;
&lt;li&gt;MongoDB ODMantic for ODM creation&lt;/li&gt;
&lt;li&gt;Next.js/React Frontend with middleware authorization for page access control, Form validation using React Hook Form, State management with Redux, and CSS and templates with TailwindCSS, HeroIcons, and HeadlessUI&lt;/li&gt;
&lt;li&gt;Operational and Monitoring Tools: Includes Celery for task management, Flower for job monitoring, Traefik for seamless load balancing and HTTPS certificate automation, and Github Actions for comprehensive front-end and back-end testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Go from zero to fullstack FastAPI application in less than ten minutes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj47orez6gaj4debprqmd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj47orez6gaj4debprqmd.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/mongodb-labs/full-stack-fastapi-mongodb" rel="noopener noreferrer"&gt;Here is a link&lt;/a&gt; to the github repo so you can check it out!&lt;/p&gt;

</description>
      <category>fastapi</category>
      <category>python</category>
      <category>webdev</category>
      <category>react</category>
    </item>
    <item>
      <title>Best Database to use with C#</title>
      <dc:creator>rachelle palmer</dc:creator>
      <pubDate>Tue, 03 Jan 2023 13:03:01 +0000</pubDate>
      <link>https://dev.to/techbelle/best-database-to-use-with-c-24m7</link>
      <guid>https://dev.to/techbelle/best-database-to-use-with-c-24m7</guid>
      <description>&lt;p&gt;One of the biggest questions for any developer is choosing what database to use. And if you google this term, you get mostly a lot of of outdated results -- posts from 2016 on stackoverflow, links to random blogs that haven't been updated in a decade, etc. And even though we might have a resource like &lt;a href="https://db-engines.com/en/" rel="noopener noreferrer"&gt;db-engines&lt;/a&gt; to tell us the most popular databases, it doesn't tell me which databases C# developers &lt;em&gt;actually use.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I decided to take the StackOverflow survey raw results, filter them for C# developers only, and then do some calculations on which databases are used extensively by C# developers. Voila!&lt;/p&gt;

&lt;p&gt;Out of the 83k SO survey responses of 2021, 22,984 were developers who know C#. This is a fairly large sample, so let's proceed.&lt;/p&gt;

&lt;h2&gt;
  
  
  What databases are used with C#?
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;An astounding 55.49% of C# developers use Microsoft SQL Server. This is a gigantic number considering the number of potential choices. Microsoft SQL server is far more popular with C# developers than it is with anyone else - just 22% of all StackOverflow developers use it overall.&lt;/li&gt;
&lt;li&gt;42.93% of C# developers use mySQL extensively, which is not that surprising&lt;/li&gt;
&lt;li&gt;32% use sqlite. &lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What database do C# developers want to use?
&lt;/h2&gt;

&lt;p&gt;Here's where the data gets really interesting. When you compare the number of developers using a database vs what database they say they want to use, that's where we see the difference between preference/desire ("want") vs what our jobs insist upon. This is actually true for a lot of databases, where we see the number of developers are using something is &lt;em&gt;more than&lt;/em&gt; the number of developers who say they want to. For example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Even though 55% of C# developers use Microsoft SQL server, just &lt;strong&gt;35%&lt;/strong&gt; say they want to use it. 35% is still a very large number, but that's a fairly significant loss.&lt;/li&gt;
&lt;li&gt;29% of developers use PostgreSQL, and 28% want to use it (imo, a trivial difference)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We can also see there are some databases where the usage lags than the number of developers who want to use it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;MongoDB (25.34%)&lt;/li&gt;
&lt;li&gt;Redis (20.53%)&lt;/li&gt;
&lt;li&gt;Elastic (14.08%)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Pretty surprising results.&lt;/p&gt;

&lt;h2&gt;
  
  
  What databases are not used with C#?
&lt;/h2&gt;

&lt;p&gt;DynamoDB, Couchbase, Cassandra, DB2 all fared very poorly with C# developers. Cassandra in particular had just 501 users, a market share of 2%. Couchbase was even worse, with 337 (1.47% of C# developers).&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>database</category>
      <category>dotnet</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Building my first Go App with Github Copilot</title>
      <dc:creator>rachelle palmer</dc:creator>
      <pubDate>Sat, 24 Dec 2022 03:31:48 +0000</pubDate>
      <link>https://dev.to/techbelle/building-my-first-go-app-with-github-copilot-3g56</link>
      <guid>https://dev.to/techbelle/building-my-first-go-app-with-github-copilot-3g56</guid>
      <description>&lt;p&gt;It's been just a few months since Github made Copilot, and yet the new Github Copilot extension for VS Code already has more than 2 million downloads. This is a huge amount of people, and I wanted to see if the hype is real. I decided to try and build a few apps with a programming language that I don't know - Golang - and see how successful it might be.&lt;/p&gt;

&lt;h2&gt;
  
  
  My Ground Rules
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Don't read a lot of Go docs. If I'm the one writing most of the code, or spending time in the docs, that would be a fail&lt;/li&gt;
&lt;li&gt;Don't try anything TOO fancy... but don't go easy on Copilot either. This is not a marketing puff piece. I really want to know what's possible.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Experiment 1: Hello World
&lt;/h2&gt;

&lt;p&gt;After installing go, the VS Code go extension, and the Github Copilot extension, I created a new file, skimmed &lt;em&gt;one&lt;/em&gt; tutorial, and typed&lt;br&gt;
&lt;code&gt;package main&lt;/code&gt;&lt;br&gt;
&lt;code&gt;import&lt;/code&gt; &lt;br&gt;
Github Copilot then suggested &lt;code&gt;fmt&lt;/code&gt;&lt;br&gt;
Github then suggested &lt;code&gt;func main()&lt;/code&gt;&lt;br&gt;
once I accepted this suggestion, GC replied with&lt;br&gt;
&lt;code&gt;{fmt.PrintIn("Hello World!")&lt;br&gt;
}&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Verdict: Hell yea, this works!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Experiment 2: Build Your Own Container
&lt;/h2&gt;

&lt;p&gt;For something a little more difficult, I turned to this &lt;a href="https://www.infoq.com/articles/build-a-container-golang/" rel="noopener noreferrer"&gt;Build Your Own Container&lt;/a&gt; tutorial. I typed&lt;br&gt;
&lt;code&gt;package main&lt;/code&gt;&lt;br&gt;
&lt;code&gt;import(&lt;/code&gt;&lt;br&gt;
and Copilot suggested &lt;code&gt;fmt&lt;/code&gt;. &lt;br&gt;
After accepting this suggestion, I typed &lt;code&gt;os&lt;/code&gt;, and Copilot suggested &lt;code&gt;os/exec&lt;/code&gt;.&lt;br&gt;
Then, I typed &lt;code&gt;func&lt;/code&gt;... and Copilot veered off course with this:&lt;br&gt;
&lt;code&gt;main() {&lt;br&gt;
    binary, lookErr := exec.LookPath("ls")&lt;br&gt;
    if lookErr != nil {&lt;br&gt;
        panic(lookErr)&lt;br&gt;
    }&lt;br&gt;
    args := []string{"ls", "-a", "-l", "-h"}&lt;br&gt;
    env := os.Environ()&lt;br&gt;
    execErr := syscall.Exec(binary, args, env)&lt;br&gt;
    if execErr != nil {&lt;br&gt;
        panic(execErr)&lt;br&gt;
    }&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verdict: No.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I typed &lt;code&gt;switch os.Args[1]{&lt;/code&gt;&lt;br&gt;
and from there Copilot helpfully offers:&lt;br&gt;
&lt;code&gt;&lt;br&gt;
case "run": &lt;br&gt;
parent()&lt;br&gt;
case "child":&lt;br&gt;
child()&lt;br&gt;
default:&lt;br&gt;
panic("what?")&lt;br&gt;
}&lt;br&gt;
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And we're back on track! &lt;/p&gt;

&lt;p&gt;I continue on with this tutorial and the verdict is that although Copilot sometimes offers &lt;em&gt;wrong&lt;/em&gt; suggestions for what I want, the code itself is great. If I give it just a tiny hit, it can give me entire blocks of code that are more than 90% accurate.&lt;/p&gt;

&lt;p&gt;Final code matches the tutorial almost exactly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F64dpr9lmiii7qzwdy11r.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F64dpr9lmiii7qzwdy11r.jpg" alt="Image description" width="800" height="819"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Verdict:...&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtn2q5lc3fg36q47rw5x.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxtn2q5lc3fg36q47rw5x.jpeg" alt="Image description" width="585" height="427"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ultimately I was pretty impressed by what is possible. I still don't know golang and I'm unlikely to learn, but I did feel like I'd be capable of building an application within a matter of weeks with something like Gopilot as a sort of 'uber linter`. &lt;/p&gt;

</description>
      <category>go</category>
      <category>github</category>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Where to Learn MongoDB in 2023</title>
      <dc:creator>rachelle palmer</dc:creator>
      <pubDate>Mon, 19 Dec 2022 15:13:23 +0000</pubDate>
      <link>https://dev.to/mongodb/where-to-learn-mongodb-in-2023-18mn</link>
      <guid>https://dev.to/mongodb/where-to-learn-mongodb-in-2023-18mn</guid>
      <description>&lt;p&gt;If you ask OpenAI where to learn MongoDB, you get a pretty dull answer:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;MongoDB offers a variety of online and offline resources to help you learn MongoDB, including official documentation, tutorials, and the MongoDB University course. Additional learning resources include the MongoDB blog and community resources like MongoDB Atlas and Stack Overflow.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It's ok but not the best response - MongoDB Atlas is a platform, not a community resource - so I'm giving you our list of where we recommend learning MongoDB.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. YouTube
&lt;/h2&gt;

&lt;p&gt;Whether you want to &lt;a href="https://www.youtube.com/watch?v=ofme2o29ngU" rel="noopener noreferrer"&gt;learn MongoDB in 30 Minutes&lt;/a&gt;, &lt;a href="https://www.youtube.com/watch?v=ofme2o29ngU" rel="noopener noreferrer"&gt;Learn MERN stack&lt;/a&gt; in an hour, or take on &lt;a href="https://www.youtube.com/watch?v=nu_pCVPKzTk&amp;amp;t=15530s" rel="noopener noreferrer"&gt;Full Stack Web Development&lt;/a&gt; with freecodecamp, or a course to &lt;a href="https://www.youtube.com/watch?v=X3eSATZhXp0&amp;amp;t=278s" rel="noopener noreferrer"&gt;learn Python in Hindi&lt;/a&gt;, there's pretty much something for everyone.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. MongoDB University
&lt;/h2&gt;

&lt;p&gt;Just relaunched in November, the new MongoDB University available at &lt;a href="https://learn.mongodb.com/catalog?labels=%5B%22Learning%20Format%22%5D&amp;amp;values=%5B%22Learning%20Path%22%5D" rel="noopener noreferrer"&gt;learn.mongodb.com&lt;/a&gt; completely revised its beginner level content and associate level certifications. &lt;/p&gt;

&lt;h2&gt;
  
  
  3. Udemy
&lt;/h2&gt;

&lt;p&gt;Do you just prefer to pay for learning? Udemy has great courses for web development for every programming language. My personal favorite is the &lt;a href="https://www.udemy.com/course/mern-stack-front-to-back/" rel="noopener noreferrer"&gt;MERN stack front to back course&lt;/a&gt;, which is discounted right now to just $15.99 from $84.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. MongoDB Developer Center
&lt;/h2&gt;

&lt;p&gt;If you prefer to learn from step by step tutorials and code examples, the MongoDB Developer Center offers articles, quick starts, github repositories for every programming language. As an example, here's the aggregated page for &lt;a href="https://www.mongodb.com/developer/technologies/nextjs/" rel="noopener noreferrer"&gt;Next.JS tutorials&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Official Documentation
&lt;/h2&gt;

&lt;p&gt;And, of course, the official MongoDB documentation will always prove useful. In particular, users find the &lt;a href="https://www.mongodb.com/docs/guides/" rel="noopener noreferrer"&gt;MongoDB guides&lt;/a&gt; helpful. &lt;/p&gt;

&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@nickmorrison?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Nick Morrison&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/learning?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gratitude</category>
    </item>
    <item>
      <title>Best Free Courses to Learn WebDev for Beginners</title>
      <dc:creator>rachelle palmer</dc:creator>
      <pubDate>Tue, 20 Sep 2022 19:57:29 +0000</pubDate>
      <link>https://dev.to/techbelle/best-free-course-to-learn-mongodb-for-beginners-l4i</link>
      <guid>https://dev.to/techbelle/best-free-course-to-learn-mongodb-for-beginners-l4i</guid>
      <description>&lt;p&gt;If you are interested in learning web development and looking for some awesome resources online, then this post is for you.&lt;/p&gt;

&lt;p&gt;There are so many tutorials available, it can be hard to choose which one is 'best'. I'm usually interested in doing a real project, lots of live coding, and very clear instructions. This is because when I'm trying to code, I tend to need to pause or rewind the video. &lt;/p&gt;

&lt;p&gt;Below are some of my personal favorites:&lt;/p&gt;

&lt;p&gt;1) &lt;a href="https://www.youtube.com/watch?v=BWUi6BS9T5Y&amp;amp;t=0s" rel="noopener noreferrer"&gt;Build a REST API with Node.js, Express, TypeScript, and MongoDB&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2)&lt;a href="https://www.youtube.com/watch?v=mrHNSanmqQ4" rel="noopener noreferrer"&gt;Freecodecamp MERN stack tutorial&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;3) &lt;a href="https://www.youtube.com/watch?v=Q70IMS-Qnjk" rel="noopener noreferrer"&gt;Build a Tindr Clone Full Stack Application with NodeJS and React&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;4) &lt;a href="https://www.youtube.com/watch?v=-0exw-9YJBo" rel="noopener noreferrer"&gt;Youtube - Learn the MERN Stack in 60 Minutes&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;5) &lt;a href="https://www.youtube.com/watch?v=P6gEnVlJPOc" rel="noopener noreferrer"&gt;Build a Fullstack SvelteKit ToDo App with TailWind CSS and MongoDB&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;6) &lt;a href="https://www.youtube.com/watch?v=5hvhKgkRzIs" rel="noopener noreferrer"&gt;Serverless Vercel Svelte Project&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These should be more than enough to get you started, let me know your favorite courses in the comments!&lt;/p&gt;

&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@shimikumi32?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Kumiko SHIMIZU&lt;/a&gt; on &lt;a href="https://unsplash.com/s/photos/green-leaves?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Unsplash&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>svelte</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Great MongoDB Resources for Python Developers</title>
      <dc:creator>rachelle palmer</dc:creator>
      <pubDate>Tue, 31 May 2022 18:34:48 +0000</pubDate>
      <link>https://dev.to/mongodb/great-mongodb-resources-for-python-developers-48a6</link>
      <guid>https://dev.to/mongodb/great-mongodb-resources-for-python-developers-48a6</guid>
      <description>&lt;p&gt;If you're new to MongoDB, or new to Python, it may seem overwhelming just how many resources are available to look at. Here are some of the most loved resources, tools, or tutorials that are guaranteed to get you started quickly with using MongoDB and Python.&lt;/p&gt;

&lt;h3&gt;
  
  
  Eve - the Python Rest API to use with MongoDB
&lt;/h3&gt;

&lt;p&gt;Eve is an open source Python REST API framework powered by Flask and Cerberus. Eve offers native support for using MongoDB with python and has an easy quickstart &lt;a href="https://docs.python-eve.org/en/stable/quickstart.html" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  A FastAPI and MongoDB example project
&lt;/h3&gt;

&lt;p&gt;If you don't want a wordy read through but really just need to look at some code, check out &lt;a href="https://github.com/mongodb-developer/pymongo-fastapi-crud" rel="noopener noreferrer"&gt;this github project&lt;/a&gt;. This is a simple CRUD application built using the MongoDB Python driver (PyMongo) and FastAPI. You can also follow the step-by-step &lt;a href="https://www.mongodb.com/languages/python/pymongo-tutorial" rel="noopener noreferrer"&gt;tutorial&lt;/a&gt; for building this application. &lt;/p&gt;

&lt;h3&gt;
  
  
  pymongoarrow - a library to import/export data between MongoDB and Pandas dataframe, numpy array, parquet file, csv
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://pypi.org/project/pymongoarrow/" rel="noopener noreferrer"&gt;pymongoarrow&lt;/a&gt; takes less than 15 minutes to install, understand, and use. Way better than sifting through 4 years of stack overflow posts and trying to find a correct example of how to do this.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tech with Tim MongoDB Python Video Tutorials
&lt;/h3&gt;

&lt;p&gt;This &lt;a href="https://www.youtube.com/watch?v=UpsZDGutpZc&amp;amp;t=2s" rel="noopener noreferrer"&gt;short series on youtube&lt;/a&gt; builds a full MongoDB Python application - video 1 is about beginner level CRUD. The &lt;a href="https://www.youtube.com/watch?v=nYNAH8K_UhI" rel="noopener noreferrer"&gt;second video&lt;/a&gt; features Schema Validation, Bulk Inserts, Data Modeling, and Advanced Queries, and the &lt;a href="https://www.youtube.com/watch?v=nc-Kpiq1zLc" rel="noopener noreferrer"&gt;third video&lt;/a&gt; demonstrates full text search of MongoDB data.&lt;/p&gt;

&lt;h3&gt;
  
  
  The MongoDB Developer Center
&lt;/h3&gt;

&lt;p&gt;Last but not least, we have &lt;a href="https://www.mongodb.com/developer/languages/python/" rel="noopener noreferrer"&gt;our MongoDB developer center&lt;/a&gt;, where we feature the Python programming language and have news, tutorials, articles of interest, etc.&lt;/p&gt;

</description>
      <category>python</category>
      <category>mongodb</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Prisma now offers MongoDB Support!</title>
      <dc:creator>rachelle palmer</dc:creator>
      <pubDate>Mon, 25 Apr 2022 15:10:23 +0000</pubDate>
      <link>https://dev.to/mongodb/prisma-now-offers-mongodb-support-2j54</link>
      <guid>https://dev.to/mongodb/prisma-now-offers-mongodb-support-2j54</guid>
      <description>&lt;p&gt;In very exciting news, Prisma.io recently announced the general availability of support for MongoDB. For those of you who are unfamiliar, Prisma is a next-generation objection-relational mapper (ORM) that makes development of web applications with Node.js and Typescript lightning fast. It’s worth noting that Prisma is the only fully type-safe ORM in the TypeScript ecosystem. The generated Prisma client ensures typed query results even for partial queries and relations. Tinkering with it was super easy - it’s very developer friendly and a welcome abstraction layer for error-prone querying. &lt;/p&gt;

&lt;h2&gt;
  
  
  How does it work?
&lt;/h2&gt;

&lt;p&gt;Every project starts with a &lt;a href="https://www.prisma.io/docs/concepts/components/prisma-schema" rel="noopener noreferrer"&gt;Prisma schema file&lt;/a&gt;. The schema file allows developers to define application models in an intuitive data modeling language. This helps prevent data inconsistencies and bloated data models. It also contains the connection to your MongoDB database and defines a generator (‘the prisma client’). The prisma client is an auto-generated and type-safe query builder for TypeScript (and Node.js). With autocompletion right in Prisma’s code editor, developers can more easily build queries of their MongoDB data without needing to look up reference documentation. &lt;/p&gt;

&lt;h2&gt;
  
  
  How to get started?
&lt;/h2&gt;

&lt;p&gt;Despite Prisma support for MongoDB being fairly new, there are already a plethora of resources available on this topic, so I thought I would condense those into one quick guide. To get started, you’ll need to complete the following steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;a href="https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/mongodb-typescript-mongodb" rel="noopener noreferrer"&gt;Create a Prisma project&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.prisma.io/docs/concepts/components/prisma-schema" rel="noopener noreferrer"&gt;Create a Prisma schema and start data modeling&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.prisma.io/docs/concepts/overview/what-is-prisma#accessing-your-database-with-prisma-client" rel="noopener noreferrer"&gt;Generate a Prisma client&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.prisma.io/dataguide/mongodb/mongodb-atlas-setup" rel="noopener noreferrer"&gt;Create an Atlas cluster&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/mongodb/connect-your-database-typescript-mongodb" rel="noopener noreferrer"&gt;Connect to your Atlas cluster&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/mongodb/querying-the-database-typescript-mongodb#write-data-into-the-database" rel="noopener noreferrer"&gt;Write data&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.prisma.io/docs/getting-started/setup-prisma/start-from-scratch/mongodb/querying-the-database-typescript-mongodb" rel="noopener noreferrer"&gt;Query your data with the Prisma client&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Note if you want to explore your data you can do that in the Prisma Studio visual editor, or you can use MongoDB &lt;a href="https://www.mongodb.com/try/download/compass" rel="noopener noreferrer"&gt;Compass&lt;/a&gt;, or you can use the data explorer available in the Atlas UI, or you can use the MongoDB VS Code Extension... there are a lot of options here.&lt;/p&gt;

&lt;h2&gt;
  
  
  How does Prisma differ from Mongoose?
&lt;/h2&gt;

&lt;p&gt;Mongoose is another ORM (or ODM, depending on who you ask…) for MongoDB. How are they different? Which one is the better fit? Here’s &lt;a href="https://www.prisma.io/docs/concepts/more/comparisons/prisma-and-mongoose" rel="noopener noreferrer"&gt;a simple comparison&lt;/a&gt; of various queries with each of them.&lt;/p&gt;

&lt;p&gt;Most developers should find Prisma’s minimal API a welcome change from overly complex competitors in this space - certainly most of the features advertised, the average developer doesn’t really need. I’ve now built a couple of quick applications with Prisma and Node.js and I find it very intuitive and easy to get something up and running. As with all ORMs it is an abstraction layer, so you do sacrifice some flexibility in the name of usability and productivity - but I didn’t hit any of those alleged limitations and I’m not convinced most people would, even when building a more robust application.&lt;/p&gt;

&lt;p&gt;We hope you’ll give it a try (for science!) and let us know your thoughts. We also have a whole week of activities with Prisma ahead where you can learn more about using Prisma with MongoDB - check out the &lt;a href="https://www.prisma.io/mongodb-launch" rel="noopener noreferrer"&gt;launch website&lt;/a&gt; to learn more and join us!&lt;/p&gt;

&lt;p&gt;You can also check out Prisma on &lt;a href="https://github.com/prisma/prisma" rel="noopener noreferrer"&gt;github&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>prisma</category>
      <category>javascript</category>
      <category>typescript</category>
      <category>mongodb</category>
    </item>
    <item>
      <title>.Net Analyzer for MongoDB</title>
      <dc:creator>rachelle palmer</dc:creator>
      <pubDate>Mon, 07 Feb 2022 18:42:29 +0000</pubDate>
      <link>https://dev.to/mongodb/net-analyzer-for-mongodb-2dob</link>
      <guid>https://dev.to/mongodb/net-analyzer-for-mongodb-2dob</guid>
      <description>&lt;p&gt;C# and .NET developers know that it can sometimes be frustrating to work idiomatically with MongoDB queries and aggregations: without a way to see if your LINQ query or Builder expression corresponds to the MongoDB Query API &lt;em&gt;during&lt;/em&gt; development, we had to wait for runtime errors in order to troubleshoot queries. &lt;/p&gt;

&lt;p&gt;Not anymore.&lt;/p&gt;

&lt;p&gt;With the new MongoDB Analyzer for .NET, instead of mentally mapping the idiomatic version of a query in C# to the MongoDB Query API, the MongoDB Analyzer does it for you - and even provides the generated Query API expression right in your IDE. The MongoDB Analyzer surfaces useful hints and helpful warnings on invalid expressions at compile time, bringing greater visibility to the root causes of bugs. When used together with the recently released LINQ3 provider (supported in MongoDB C#/.NET Driver 2.14.0 and higher), you can compose and understand more advanced queries easily, including aggregations. The MongoDB Analyzer can also be used from the CLI to integrate into CI/CD pipelines.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd88aip96vg8v9ceq1zmt.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fd88aip96vg8v9ceq1zmt.gif" alt="Image description" width="800" height="174"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In Visual Studio, install the MongoDB.Analyzer NuGet package via package manager:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Install-Package MongoDB.Analyzer -Version 1.0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dotnet add package MongoDB.Analyzer --version 1.0.0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;for the .net CLI.&lt;/p&gt;

&lt;p&gt;Once installed, it will be added to your project’s Dependencies list, under Analyzers. Once the analyzer has run, you’ll find all of the diagnostic warnings output to the Error List panel. As you inspect your code, you’ll also see that any unsupported expressions will be highlighted.&lt;/p&gt;

&lt;p&gt;MongoDB Analyzer surfaces any unsupported expressions and invalid queries at compile time. You’ll find all of these issues listed as warnings in the Visual Studio Error List. This is also quite useful as not all LINQ expressions are supported by the MongoDB C#/.NET driver right now. Similarly, supported expressions will differ slightly depending on which version of LINQ you use. I'm loving tinkering around with it.&lt;/p&gt;

&lt;p&gt;Check out the docs and learn how to analyze your code &lt;a href="https://docs.mongodb.com/mongodb-analyzer/current/install/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>mongodb</category>
      <category>visualstudio</category>
    </item>
    <item>
      <title>How Its Made: MongoDB Compass Export to Ruby Language</title>
      <dc:creator>rachelle palmer</dc:creator>
      <pubDate>Mon, 24 Jan 2022 19:56:52 +0000</pubDate>
      <link>https://dev.to/mongodb/how-its-made-mongodb-compass-export-to-ruby-language-3lf2</link>
      <guid>https://dev.to/mongodb/how-its-made-mongodb-compass-export-to-ruby-language-3lf2</guid>
      <description>&lt;p&gt;Looking for something truly useful for learning MongoDB? Imagine being able to construct a MongoDB query via the &lt;a href="https://www.mongodb.com/products/compass" rel="noopener noreferrer"&gt;MongoDB Compass&lt;/a&gt; UI while exploring your data, then exporting that same query to the programming language of your choice.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgz9v0cfgnxyuqhup36k0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgz9v0cfgnxyuqhup36k0.png" alt="Image description" width="800" height="494"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In today's "How Its Made", MongoDB Engineer &lt;a href="https://github.com/Neilshweky" rel="noopener noreferrer"&gt;Neil Shweky&lt;/a&gt; explains how he recently built out this feature for Ruby. &lt;/p&gt;

&lt;p&gt;Getting this functionality working required that Ruby be added as an output language to our &lt;a href="https://github.com/mongodb-js/compass/tree/main/packages/bson-transpilers" rel="noopener noreferrer"&gt;BSON Transpilers&lt;/a&gt; project. As an aside, if you spent a lot of time in university (or just for fun) with compilers, parsers, and other fun functional-programming-related problems, this is a project for you. &lt;/p&gt;

&lt;p&gt;Our BSON transpilers enable users to convert a MongoDB query from one programming language to another via a YAML template file that specifies how to generate code for the specific language in a variety of situations. For example, if the output language is Python and the input code is &lt;code&gt;'3 in [1,2,3]'&lt;/code&gt; the following template is used to generate equivalent Ruby code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;InSyntaxTemplate:
(lhs, op, rhs) =&amp;gt; {
  let str = '';
  if (op.includes('!') || op.includes('not')) {
    str = '!';
  }
  return${str}${rhs}.include?(${lhs})
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This template takes in an &lt;code&gt;lhs&lt;/code&gt; value of &lt;code&gt;3&lt;/code&gt; and a &lt;code&gt;rhs&lt;/code&gt; value of &lt;code&gt;[1,2,3]&lt;/code&gt;. The equivalent Ruby code that is then generated to test for array membership would be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;include?&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first step in this process was to complete a series of tests which would evaluate a code statement from an input language and output it to Ruby. Then to take those learnings and complete the templates in the ruby template file.&lt;/p&gt;

&lt;p&gt;Simple enough, right?&lt;/p&gt;

&lt;p&gt;The most difficult part of this work was making decisions on what code is considered &lt;em&gt;idiomatic to Ruby.&lt;/em&gt; The Ruby language offers so many ways to express the same concepts, however our goal was to choose the ideal way that would make sense to Ruby developers. As an example, assignment of a key/value pair to a &lt;a href="https://ruby-doc.org/core-3.1.0/Hash.html" rel="noopener noreferrer"&gt;Hash&lt;/a&gt; of &lt;code&gt;{ x: 1 }&lt;/code&gt; can be done multiple different ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;{ x: 1 }&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;{ :x =&amp;gt; 1 }&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;{ :'x' =&amp;gt; 1 }&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;{ 'x': 1 }&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;{ 'x' =&amp;gt; 1 }&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Well...&lt;/p&gt;

&lt;p&gt;Eagle-eyed Rubyists will note that the keys above vary between being &lt;a href="https://ruby-doc.org/core-3.1.0/Symbol.html" rel="noopener noreferrer"&gt;Symbols&lt;/a&gt; and &lt;a href="https://ruby-doc.org/core-3.1.0/String.html" rel="noopener noreferrer"&gt;Strings&lt;/a&gt; so it's not technically "5 different ways of assigning &lt;em&gt;exactly the same thing&lt;/em&gt;", but we chose this example to illustrate the flexibility the Ruby language offers. At the end of the day, we opted to use the last option, because we felt like this would "look right" to most Ruby developers.&lt;/p&gt;

&lt;p&gt;Results in the Compass UI:&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiuy88xlvl48cb4w4hq4e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiuy88xlvl48cb4w4hq4e.png" alt="Image description" width="800" height="490"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For future enhancements, we are thinking about adding Ruby as an input language. This would allow a user to convert queries written in Ruby to any of the other languages we have implemented such as Java, C#, Javascript, Python, with Golang and even Rust.&lt;/p&gt;

&lt;p&gt;The next time you're &lt;a href="https://docs.mongodb.com/compass/current/export-query-to-language/" rel="noopener noreferrer"&gt;exporting your query&lt;/a&gt; from within MongoDB Compass give Ruby a try and let us know what you think. If you're curious how all this works the &lt;a href="https://github.com/mongodb-js/compass" rel="noopener noreferrer"&gt;repo for MongoDB Compass&lt;/a&gt; is available for exploration.&lt;/p&gt;

&lt;p&gt;-- Rachelle, Product Lead for Developer Experience&lt;/p&gt;

&lt;p&gt;P.S. Neil is also on &lt;a href="https://twitter.com/neil_shweky" rel="noopener noreferrer"&gt;twitter&lt;/a&gt; and &lt;a href="https://dev.to/neilshweky"&gt;devto&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>mongodb</category>
      <category>bson</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
