Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • supertrip 4 posts 75 karma points
    May 01, 2022 @ 20:44
    supertrip
    1

    Umbraco 9 plugin reading data from NoSQL database

    Hey there, I am learning how to develop plugins for Umbraco.

    I followed this tutorial and everything seems to be working just fine.

    However, I found no indication on how to read from a separate database (not the one in use by Umbraco). I would like to keep the SQL database in use by Umbraco separate from the one where I need to store the data to be accessed by my plugin. The request from my client is to use a NoSQL database (Cosmos DB on MS azure, or MongoDB). How can I read from an additional database (NoSQL)? Where should I put the connection string in my plugin? Does anyone have a template, a tutorial, or any indication that might help me?

    Thank you so much in advance...

  • Prashansa 3 posts 73 karma points
    Oct 30, 2022 @ 16:46
    Prashansa
    0

    I've updated some sample code in the ReadMe file of https://www.nuget.org/packages/UmbracoMongoDbClient

    var database = MongoDBClientConnection.GetDatabase("YouDatabaseName");
    var collection = database.GetCollection<T>("YourCollectionName"); // of type T
    
Please Sign in or register to post replies

Write your reply to:

Draft