Intro to MongoDB with C# - Learn what NoSQL is, why it is different than SQL and how to use it in C#

Поделиться
HTML-код
  • Опубликовано: 22 авг 2024

Комментарии • 568

  • @johnconnor9787
    @johnconnor9787 5 лет назад +5

    Video is uploaded 5 minutes ago and someone already clicked a dislike. Hey man, you even did not watch this!!!
    Thank you Tim for this tutorial. Thumb up!

    • @NorbertWebDev
      @NorbertWebDev 5 лет назад

      Lol, dident even remake the dislike, there are some bad people runing round the internet :)))

    • @IAmTimCorey
      @IAmTimCorey  5 лет назад +6

      Yeah, I saw that. The funny thing is that RUclips cares about engagement. The more engagement a video gets (likes, dislikes, comments), the higher they rank it so technically, that person is helping me just a bit. :-)

    • @23myiah
      @23myiah 5 лет назад +1

      Yes, very poor show to dislike without even viewing. Thank you Tim for giving us your time and knowledge.

    • @pylvr8021
      @pylvr8021 5 лет назад +3

      She must be an Ex lol

  • @ben.thornhill
    @ben.thornhill 5 лет назад +9

    Awesome introduction to NoSQL for .NET developers! Thanks as always and best wishes Tim.

  • @Evan-zj5mt
    @Evan-zj5mt 4 года назад +2

    Dude, your videos are great. Neither rushed nor slow, and including all of the salient information a newbie to a subject needs. Kudos!

  • @codecomposer88
    @codecomposer88 2 года назад +2

    Thank you for a good introduction, Tim. Been using MSSQL for many years and knows it very well. For me this was a first look at NoSQL, and it looks very very interesting! At first it feels very uncomfortable with the loose data structure but it really makes a lot of sense. Just the fact that the termonology is "documents" rather than "tables" makes so much sense; love that we're simply just storing the data as it actually is instead of joining tables and all that.

  • @iamtheone9670
    @iamtheone9670 Год назад +2

    Thank you Tim Corey, you explained that mongoDb is faster than sql perfectly. Have learned something new!

    • @IAmTimCorey
      @IAmTimCorey  Год назад +1

      It can be faster. That doesn't mean it is always the better choice. There are always tradeoffs. I'm glad it was valuable.

  • @DasturlashniOrganamiz
    @DasturlashniOrganamiz 3 года назад +1

    Mr. Corey, thank you. I am accepted to an internship position in an international company called Exadel. The knowledge you are sharing in RUclips is priceless. I am still learning from your content and plan to one your paid courses once I receive my salary as a .net developer.
    Your student from Uzbekistan :)

    • @IAmTimCorey
      @IAmTimCorey  3 года назад

      Awesome! I am glad I was able to be a part of your journey.

  • @emirhandemirci6677
    @emirhandemirci6677 4 года назад +1

    Tim Corey Very useful tutorial. Learned all the basics for a NoSql database in just 1 hour. Keep up the good work!

  • @ohmyohmyohmy2
    @ohmyohmyohmy2 5 лет назад +1

    Another terrifically educational video. Thanks for taking the time to produce and post. Always look forward to your content.

  • @RalfsBalodis
    @RalfsBalodis 3 года назад +6

    0:00 - Intro
    1:27 - Setup: Mongo DB Community Server installation
    8:06 - Creating Demo Core Console App
    9:35 - MongoDB NuGet
    11:04 - Mongo CRUD
    12:50 - "Connection string"
    14:50 - Connecting to database
    17:13 - Data storage in MongoDB
    24:39 - Inserting data in database
    28:07 - Changing data set structure
    30:45 - Inserting different data set in the table and benefit of NoSQL
    36:52 - Retrieving data form database
    42:00 - MongoDB Query
    48:40 - Update and delete methods
    54:28 - Insert or Update record
    59:00 - Delete record
    59:42 - Returning different data model from database record
    1:02:55 - Demo code clean up
    1:03:20 - MongoDB when and why?
    1:15:15 - Summary and concluding remarks

  • @anshulchoure7521
    @anshulchoure7521 3 года назад +1

    I am learning NoSQL for the first time and its the best video have found it very informative and in very understandable tone. MongoDB is very good NoSQL option with .NET Core. Thanks

  • @xeyalteyyubov1175
    @xeyalteyyubov1175 2 года назад +1

    Thanks, Tim that is one of the most beautiful no SQL videos on youtube.

  • @steejayk
    @steejayk 5 лет назад +1

    Your video is NEVER too long!

  •  3 года назад +1

    Thanks Tim. Very nice introduction to MongoDB and NoSQL world.

  • @artemprokhorov506
    @artemprokhorov506 5 лет назад +23

    Hello Tim,
    You have a logical error in this video starting from the time position 1:00:00, when you tried to bring and use new NameModel class. It is working for you because you deleted the last record that has PrimaryAddress just before you introduced NameModel. If you actually have couple existing records in DB, some of them have only FirstName and LastName (and Id for sure) and some have FirstName, LastName and PrimaryAddress, you won't be able to use NameModel as you just did. You will have unhandled exception in the line:
    return collection.Find(new BsonDocument()).ToList();
    saying: 'Element 'PrimaryAddress' does not match any field or property of class MongoDBDemo.NameModel.'
    So you cannot "narrow down" your objects so easily if you actually have additional data in the MongoDB, you will have to use some conversion.

    • @IAmTimCorey
      @IAmTimCorey  5 лет назад +17

      I forgot to show that. Sorry about that. The solution is to put a [BsonIgnoreExtraElements] on the top of your model and it will work. I meant to show it. Thanks for pointing it out.

  • @antonzhernosek5552
    @antonzhernosek5552 2 года назад +1

    Even though I don't like how long the videos are, they're on a whole other level of usefulness compared to any other online tutorial. You're a godsend, Tim

    • @IAmTimCorey
      @IAmTimCorey  2 года назад

      I am glad you find them valuable.

  • @AnalogDave
    @AnalogDave 3 года назад +1

    Thanks for this. It really helped me understand MongoDB and when to use it. I've been using MSSQL for 20 years. I don't see using mongodb for anything at work yet, but I'm testing it with a app at home.

  • @taha5871
    @taha5871 4 года назад +1

    Awesome video explaining how u use MongoDB with C# , thanks so much 💙💙

  • @amirday2daychallenge
    @amirday2daychallenge 5 лет назад +1

    Tq for your short and sweet video about how to use MongoDB in C#, it was handy.

    • @IAmTimCorey
      @IAmTimCorey  5 лет назад +1

      You are most welcome. Thanks for watching.

  • @shrimpsnplants
    @shrimpsnplants 5 лет назад

    "That's the basic structure of MongoDB meaning that isn't really a structure" you made my day :D

  • @alexcyoung
    @alexcyoung 5 лет назад

    Great video Tim! And a nice, simple way of handling CRUD operations without requiring models to inherit from a common 'entity' base class.

    • @IAmTimCorey
      @IAmTimCorey  5 лет назад

      Thanks. I considered a common model base but decided against it for this video.

  • @mirragemelkyr
    @mirragemelkyr 3 года назад +1

    This is a great Video, I've done a introductory course in MongoDB, but as you said it right "this is my new tool... then now what?" even they in that course just tell you about using it with console and Atlas so this is a very good piece of material to integrate it with C# Thanks a lot.

  • @AM-rl8lv
    @AM-rl8lv 3 года назад +2

    Wow awesome video as always Tim! Since you asked at the end of your video, perhaps you can make a subsequent video explaining / integrating Microsoft Identity with MongoDB!

  • @georgetuccio6053
    @georgetuccio6053 4 года назад

    As usual, a very, very nice video. Got a project on this noSQL thing and had no idea where to start. Was most-delighted when I saw you did a video because I knew it was going to be the best place to start. Took me through all the CRUD operations and can't believe how simple it is in C#. The Cosmo Db in Azure is a "fake" MongoDb. It offers various "API"s, one of them is Mongo. So, for the most part, you send it normal Mongo instructions and it responds, just like Mongo. Cool. And, only costs about $5-$6 a month to get started. Connection String inserts just like you said it would in your video. I am a SQL Server bigot but am most-happy about being able to add this to my resume and quiver. Yeah, I can see the positives. Did have 2 questions. One, more complex filter usage for query, upsert and delete. Two, can you remove a property in a "document" once added. Not the value of the property but the property itself. Say you added something and company policy has changed and that property, from each record ("document") has to be removed for legal reasons. Also, I'm curious, it's so fast? There has to be indexing then. Is it/are they clustered or non-clustered? Would be very surprised if there were no indexes. I found the constant reference to Models interesting. So non-structured and yet the model usage. Not sure how to wrap my head around that but, coming from a very-structured world, I find this really easy going. Thanks again Tim. All the best. Awesome.

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      I will be doing other videos shortly using MongoDB. As for removing the property, you should be able to pull down the record and then save it without the property. As for the speed, its speed comes primarily from the fact that all of the data is together instead of pulling from separate locations. One quick note: I originally thought you could drop the units to 100 for MongoDB but you cannot so the smallest database you can get is 400 units, which costs $25/month. Just be careful of that.

  • @CaatjuhNL1
    @CaatjuhNL1 4 года назад

    One of the best tutorial I have followed so far! Thank you for your time and effort for making the video. Background explanation was also clear and nice to listen to. Keep it up!

  • @FakirCB
    @FakirCB 5 лет назад +1

    Thanks for another great video, Tim. I'd just like to point out that the mongo driver is quite clever and can do lambda expressions within Find() and other methods. So for example things like this are perfectly possible:
    return await db.Find(x => x.UserId == userId)
    .Skip(page * pagesize)
    .Limit(pagesize)
    .ToListAsync();

  • @amoljawalkar6273
    @amoljawalkar6273 2 года назад +1

    One of the best tutorial found online. Thank you so much

  • @alvinbernardo9551
    @alvinbernardo9551 4 года назад +2

    For all free tutorial in youtube, this is great

  • @umairraza192
    @umairraza192 3 года назад

    Excellent Tutorial ! I like the way you create these these common generic functions so we can directly use them with our models. Thank you very much for your effort and time. Stay blessed .

  • @pampula9327
    @pampula9327 5 лет назад +1

    Awesome guide and so easy to follow. Thank you very much Tim!
    I would love to see maybe simple CRUD web app using net core api with MongoDB. That would be really awesome.
    I am hard core beginner in C# and this was so easy to follow.

    • @IAmTimCorey
      @IAmTimCorey  5 лет назад +2

      I'm glad it was so easy to follow. I'll add your suggestion to the list.

  • @Tiagorockman
    @Tiagorockman 3 года назад

    Top one best video i have seen about mongodb c#. Thanks alot for share!

  • @AhmetYigiter
    @AhmetYigiter 4 года назад

    I love your videos... My English is max. intermediate but I understood everything because of your great and clean vocalization. Of course thanks for the information too...

  • @dwain.d
    @dwain.d 5 лет назад

    Thanks Tim. I'm fresh out of a programming qualification and often used your videos to further understand things, and now am currently building my first free lance production application. The application has a requirement for a database so this this video appearing is very timely. My first prototype used SQL but it felt like overkill for the data structure. I have heard a lot about Mongo from current web stacks (MEAN, MERN etc) but didn't realise I could use it from C#. I look forward to trying this out instead and seeing how it goes for my application.

    • @IAmTimCorey
      @IAmTimCorey  5 лет назад

      Excellent. Let us know how it goes.

  • @AM-rl8lv
    @AM-rl8lv 4 года назад +3

    Hi Tim thank you so much for you video's!! You are a online hero!!
    It would be awesome if you could make video where you integrate .Net Core Identity to a MongoDB back end (like in this video). Thank you so much!!

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +2

      I will add it to the list. Thanks for the suggestion.

  • @khemo240
    @khemo240 5 лет назад

    Tim you came in clutch with this tutorial....I just started using the database so your intro will be very helpful... I'm from Jamaica so the Grammer may differ from standard English 😅

  • @touseef.awan1
    @touseef.awan1 3 года назад +1

    Thank you Tim. You are best.

  • @T-par-T
    @T-par-T 3 года назад

    Mark my words: Tim is the best!

  • @rongliao9255
    @rongliao9255 4 года назад

    Great tutorial! NoSQL database can be a great choice for the new projects!

  • @DamianWalczak
    @DamianWalczak 3 года назад +1

    Thank you Tim that was very informative

  • @Tajdev
    @Tajdev 3 года назад +2

    Great Video. Please do advance Level video also which covers Aggregation, ACID AND Triggers.

  • @jaspercoleman3269
    @jaspercoleman3269 2 года назад

    Great video content as always. Thanks for sharing the knowledge, it keeps me motivated to learn more.

  • @xando81
    @xando81 4 года назад +3

    Need to decorate the NameModel a bit in order to get it to work now. 1:01:19
    [BsonIgnoreExtraElementsAttribute]
    public class NameModel
    {
    [BsonId]
    public Guid Id { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    }

  • @frozen_dusk579
    @frozen_dusk579 3 года назад

    thank you for explaining it so clearly and calmly

  • @matteobarbieri2989
    @matteobarbieri2989 5 лет назад

    great tutorial. I first had some trouble deserializing because of my MongoD release (3.6.5). With version 4 works fine

  • @rachitkohli
    @rachitkohli 2 года назад

    Love the way you explain. Good stuff there!

  • @xando81
    @xando81 4 года назад +5

    UpsertRecord with the ReplaceOne, 52:39, is obsolete in new Mongo installs. Need to replace "new BsonDocument..." with a filter on the ID
    public void UpsertRecord(string table, Guid id, T record)
    {
    // Create the collection
    var collection = db.GetCollection(table);
    // Create the filter
    var filter = Builders.Filter.Eq("Id", id);
    // Replace the record via an upsert
    // Upsert is an update if the filter finds something or
    // an insert if there is nothing matching
    collection.ReplaceOne(
    filter,
    record,
    new ReplaceOptions { IsUpsert = true });
    }

  • @kellysys
    @kellysys 4 года назад

    It was very helpful to me.
    Thank you Tim.

  • @NAIVEBOYANDY
    @NAIVEBOYANDY 4 года назад

    Eye-opening! Thank you, Tim!

  • @ronakpatel6120
    @ronakpatel6120 4 года назад

    Awesome video. You really make programming simple.

  • @andreasbrunnstrom8458
    @andreasbrunnstrom8458 4 года назад

    I have not gone through the whole video yet but thanks alot. I did not get sql server to install correctly but this works and will get me further along now :)

  • @codeme8016
    @codeme8016 3 года назад +1

    What a wonderful tutorial!

  • @asadali118
    @asadali118 5 лет назад

    Great thanks, a value able content and much appreciated instructions in the end of the video.

    • @IAmTimCorey
      @IAmTimCorey  5 лет назад +1

      You are most welcome. Thanks for watching.

  • @ahmetb3286
    @ahmetb3286 3 года назад

    That is what i am lookin for. Thx for sharing with us

  • @rajnikantsolanki8385
    @rajnikantsolanki8385 2 года назад +1

    It is nice video Tim. Thank you.

  • @TheJessejunior
    @TheJessejunior 5 лет назад

    Great intro! just cleared my mind!

  • @maximecallebaut3949
    @maximecallebaut3949 5 лет назад +1

    Thanks just got an assignment of school about mongo

  • @jakubondrak1922
    @jakubondrak1922 4 года назад +1

    Hi Tim, awesome video again. I really like your channel. This was the first time I come across with MongoDB. Do you have or plan another videos about it? I'm planning to create an application and MongoDB look promising. Thanks, Jakub

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      I do plan on using it in other videos. It will also be one of the database types in my Foundation in C# module 8 course on data access. That comes out this month.

  • @rc2893
    @rc2893 5 лет назад

    Thanks for the information. Really liked the video.

  • @toshitosliba4737
    @toshitosliba4737 Год назад +2

    Hello, I started to develop my game like a year and 3 months ago, I am alone doing this, no easy feat let me tell you and I am using Unity. I planned and divided my project in phases, first I would develop the base of the game as single player, then later on I would use the asset Fishnetworking and convert my single player game into a multiplayer. And after I finished converting my systems I hit to a point where I would need a database. For example I have features such as character creation, also I want to make a guild system and a group system. Besides of the other systems, as they need a database as well to save data, so I started to look and found about mongoDB, at first I wanted to go for mySQL, but I saw that NoSQL might be a better fit for my game. And so I started, but to me it's kind overwhelming, because I am just starting on the database field.
    And thank goodness I found your video, it goes to the point and you actually created a helper class to kind interact when I want to manage my database in some way. I am so thankful for that, this video helped me alot :)

  • @andhikaryoka4149
    @andhikaryoka4149 4 года назад

    very very helpfull tutorial, perfect explain about mongodb database. thank u master

  • @maxizinsmeister6216
    @maxizinsmeister6216 4 года назад

    Thanks for the video, very easy to follow along :)

  • @udakara9753
    @udakara9753 4 года назад

    This was really helpful bro. thank you so much

  • @rjshukla_vlogs
    @rjshukla_vlogs 3 года назад

    Great explanation in simple way

  • @zaonpt
    @zaonpt 5 лет назад +1

    Nice vid, more mongo pls!!!

    • @IAmTimCorey
      @IAmTimCorey  5 лет назад +1

      Thanks. More will be coming in the future.

  • @meriszulic9717
    @meriszulic9717 4 года назад

    Great tutorial as always. Tutorial how and when to use relations in MangoDB may be helpful too. Thanks a lot.

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      I will add it to the list. Thanks for the suggestion.

  • @mohammedyousufirfan633
    @mohammedyousufirfan633 3 года назад +1

    wonderful tutorial!

  • @HelmutPolischer
    @HelmutPolischer 3 года назад +4

    The compiler now reports a warning with the line

    new BsonDocument("_id", id)
    BsonValue.implicit operator BsonValue(Guid)' is obsolete: 'Use the BsonBinaryData constructor instead and specify a Guid representation.

    Following this advice, the method becomes the following and compiles without a warning.
    public void UpsertRecord(string table, Guid id, T record)
    {
    var collection = GetCollection(table);
    var filter = new BsonDocument("_id", new BsonBinaryData(id, GuidRepresentation.Standard));
    collection.ReplaceOne(filter, record, new ReplaceOptions { IsUpsert = true });
    }

  • @mahdiasadifard3725
    @mahdiasadifard3725 4 года назад

    It was great training, thanks Tim

  • @Diploidus
    @Diploidus 3 года назад +3

    Hi pls, fix me if I wrong.
    The query "LadAllRecords" occasionally worked for NameModel collection, just because the table didn't contain documents with Address or DOB at this moment.
    Probably you forgot to decorate class NameModel with [BsonIgnoreExtraElements]?

  • @georgefolea8914
    @georgefolea8914 4 года назад +1

    you save my life bro

  • @grampygamer8584
    @grampygamer8584 5 лет назад

    Thank you so much! Loved this!

  • @KouroushMetal
    @KouroushMetal 5 лет назад

    Very Good One. Thanks. Big questions are Group, Index, Search Speed On non-Id columns, and datagridview datasource with all these not consistent documents.

  • @malnadgowda_inusa3734
    @malnadgowda_inusa3734 5 лет назад

    Hey Tim, amazing videos. I live near Scranton PA. 😀

    • @IAmTimCorey
      @IAmTimCorey  5 лет назад

      Awesome! Hey, I'm speaking at Philly Code Camp in October ( phillydotnet.org/2019-2.html ) and TechBash in November ( techbash.com/ ). Both are fairly close to us. Stop by and say hi if you go to either event. I would love to meet you.

    • @malnadgowda_inusa3734
      @malnadgowda_inusa3734 5 лет назад

      IAmTimCorey sure definitely, I actually work in Conshohocken as .Net developer.

  • @neilvermeulen5283
    @neilvermeulen5283 4 года назад +1

    Thank you Tim

  • @yellasrinivasreddy8998
    @yellasrinivasreddy8998 2 года назад +2

    One other advantage you missed was scaling is super simple in noSql Dbs

  • @ryanjade2836
    @ryanjade2836 2 года назад +1

    Tim, thank you so much for making this videos. You have made me a better developer. Does MongoDB have an equivalent of a SQL stored procedure?

    • @IAmTimCorey
      @IAmTimCorey  2 года назад +1

      No, but there isn't a need for one.

  • @nuthanmurari
    @nuthanmurari 3 года назад +2

    If possible do a video on ACID - Comparison using SQL SERVER and MongoDB using an example.

    • @IAmTimCorey
      @IAmTimCorey  3 года назад

      I will add it to the list. Thanks for the suggestion.

  • @Pedro5antos_
    @Pedro5antos_ 3 года назад

    AWESOME!
    Really appreciated mate

    • @IAmTimCorey
      @IAmTimCorey  3 года назад

      I am glad my content has been helpful.

  • @stevepercival4663
    @stevepercival4663 4 года назад +1

    UTC - "The official abbreviation for Coordinated Universal Time is UTC. It came about as a compromise between English and French speakers. Coordinated Universal Time in English would normally be abbreviated CUT. Temps Universel Coordonné in French would normally be abbreviated TUC."

  • @idlehands34
    @idlehands34 4 года назад +1

    Thanks a lot, great tutorial :)

  • @csuporj
    @csuporj 4 года назад

    In Cluj, Romania, Banca Transilvania Atm-s used to crash several times a day when somebody tried to deposit cash in his account. The Atm swallowed the cash, but did not put it into the depositors account. I learned to don't ever put money into an Atm, when my money got swallowed on a Friday evening, and I was going to leave the country for 3 weeks on the next day.

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      Sounds like they need a better system.

  • @Saleh-le2zf
    @Saleh-le2zf 3 года назад

    You are a great person! thank you so much.

  • @DaliborHomola
    @DaliborHomola 5 лет назад

    Thank you very much!
    You're amazing man :)

  • @codecomposer88
    @codecomposer88 2 года назад +3

    Are there equivalents in MongoDB (or NoSQLs in general) to SQL views, stored procedures and triggers? Does it even make any sense to think in these terms when it comes to NoSQL?

    • @IAmTimCorey
      @IAmTimCorey  2 года назад +4

      As far as views and stored procedures, no not really. There doesn't need to be because we treat data differently. We don't focus on relationships, we focus on complete documents. We approach the problem differently, so we end up using different solutions. There can be triggers in a NoSQL database. For instance, an Azure Function can be triggered from a data change event in a CosmosDB database.

    • @codecomposer88
      @codecomposer88 2 года назад

      @@IAmTimCorey Thank you!

  • @mihunt3r929
    @mihunt3r929 Год назад

    Thank you very much for such a great tutorial

  • @dormelamed5974
    @dormelamed5974 4 года назад +1

    Hi Tim :).
    Great video like always!
    I have two questions:
    1. Every time you do - "var collection = db.GetCollection(table);" - do you bring all the data in the Users collection into the local memory?
    2. Is there a better way today to bring data by id (or another field)?
    all the -
    "var filter = Builders.Filter.Eq("Id", id);"
    and then use it like -
    "collection.Find(filter).First();"
    looks so clumsy and not elegant...
    Thanks man!

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      No, getting the collection is like opening a connection to that set of documents (that "table"). As for a better way, not really. You create the better way by wrapping that in a method.

  • @elad9209
    @elad9209 4 года назад

    hey I just watched the video and it was very helpful especially because there is rarely any approachable materials about mongodb with C#
    it could be amazing to have a playlist tutorial app with mongodb

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      I will add it to the list. Thanks for the suggestion.

  • @pabloarthur3045
    @pabloarthur3045 4 года назад

    This is the best tutorial I see for SQL Relational programmers to an introduction to a Non-SQL database. I am getting a timeout, I do not see on the tutorial where you tell the C# the connection. Is this automatically? How do I check that?

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      If you are getting a timeout, it probably means your connection string is incorrect. I would check that and verify all of the details are correct for your machine.

  • @ericrook78
    @ericrook78 Год назад +2

    You actually don't need to include the Id field in the NameModel if you add the BsonIgnoreExtraElements attribute to the NameModel class. You got the error about not having an Id because that attribute was not on the class and all of your records had an Id field. You don't get an error about the PrimaryAddress because none of your records had that.

  • @qschroed
    @qschroed 3 года назад

    Great tutorial. Thank you!

  • @cbirchy87
    @cbirchy87 3 года назад +2

    Hi Tim, It appears the ReplaceOne has been made obsolete. What the is new way of doing the same thing for an Upsert?

    • @nestle579
      @nestle579 3 года назад

      UpdateOptions was replaced by ReplaceOptions. This is my modified implementation:
      public void UpsertRecord(string table, Guid id, T reccord)
      {
      var collection = db.GetCollection(table);
      var result = collection.ReplaceOne(
      new BsonDocument("_id", new BsonBinaryData(id, GuidRepresentation.Standard)),
      reccord,
      new ReplaceOptions { IsUpsert = true });
      }

  • @saraheldah7975
    @saraheldah7975 2 года назад

    Thank you so much! that was really helpful !

    • @IAmTimCorey
      @IAmTimCorey  2 года назад

      You are welcome. If you are looking for more MongoDB content, stay tuned. More is coming soon.

    • @LGviews
      @LGviews 2 года назад

      @@IAmTimCorey Awesome, I would really be interested not only by infos on MongoDB, but also a presentation of SQL/NoSQL differences and usage cases!

  • @sir.johnbalman9877
    @sir.johnbalman9877 2 года назад +1

    so know this is an old view, but I'm wondering for a structure standpoint it seems that alot of the "child" tables or reference tables that have many to many relations are just consumed by the parent object /document..... is there any case where two document need to be related or do just call the data from document 1 that you need and then add to document 2 for future reads? I hope that was clear but i proable wasn't I contune watching your suggestion app and hope my questions get answered :)

  • @smartannu
    @smartannu 4 года назад

    awesome getting started thanks

  • @maliqattan
    @maliqattan 3 года назад

    Thank you very much. Very nice video

  • @user-xv4vz1fg1d
    @user-xv4vz1fg1d 7 месяцев назад

    Hello Tim, the video was great! Do you have a video explaining how to implement a transactions in mongo DB?

    • @IAmTimCorey
      @IAmTimCorey  7 месяцев назад +1

      In the Suggestion Site course (playlist here on RUclips), we did transactions when we handled Upvoting suggestions. I don't know the exact video, though.

  • @johnkehinde4236
    @johnkehinde4236 2 года назад

    Thanks for sharing... This is enlightening

  • @danwizedand
    @danwizedand 4 года назад +1

    I noticed that sometimes you use "_id" for the filter and sometimes "Id". I guess that using Id still works because of the BsonId decorator. If that is the case, wouldn't it be safer to always use "_id" to allow the MongoCrud to be generic and always work with whatever model you are mapping?

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      The problem is that _id doesn't conform to C# naming standards. I try to use Id wherever I can.

  • @MarcosIturribeitia
    @MarcosIturribeitia 3 года назад

    awesome video thanks for sharing !

  • @__peanut__butter28
    @__peanut__butter28 3 года назад

    this is great video!

  • @theumairtahir1
    @theumairtahir1 4 года назад

    Very helpful tutorial to start MongoDB with .Net. Can you please make some more tutorials to discuss more details about it?

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +2

      I will add it to the list. Thanks for the suggestion.