Code Monkey home page Code Monkey logo

azure-cosmosdb-mongodb-api-nodejs-bookstore's Introduction

CosmosDB Bookstore

CosmosDB Bookstore is a sample books catalog application that demonstrates the capabilities of Azure Cosmos DB API for MongoDB.

Some of the functionalities being demonstrated are:

  • Connecting to the database & the client configuration
  • Reads & Queries
  • Sorting & Indexing
  • Updates
  • Using different operators
  • Checking RU cost of the previous operation
  • Regex queries
  • Aggregation pipelines
  • Azure Search integration

Deploy the app quickly

Clone this repository and navigate to the root of the directory.

Follow the steps below to deploy the app with minimal effort and begin experimenting with the application and the codebase.

Deploy the resources to Azure

The template below deploys the application into an Azure App Service instance and creates an Azure Cosmos DB account. Simply enter the Resource Group name in this template to deploy the resources.

Deploy to Azure

Import the sample dataset into the Azure Cosmos DB API for MongoDB account

  1. Navigate to folder ./deployment/seed using Git Bash.

  2. Update .env file in this path by specifying value for "COSMOS_DB_CONNECTION_STRING" of the Cosmos DB account created by the deployment template in the previous step. You can get the connection string from Azure portal > Cosmos DB Account resource > Connection string blade > Primary connection string. Example of updated .env file: COSMOS_DB_CONNECTION_STRING="mongodb://accountname:[email protected]:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@accountname@"

  3. Execute the seeding shell script with the command './seed_data.sh'. It may take a few minutes to seed the data into books and genres collections.
    Item count of books collection is ~85k and genres collection has only 1 item.
    Successful run result looks like this:

Preparing to import data...
Installing Node modules...
Populating database...
$$$ Seeding data started 9/30/2021, 10:29:05 AM
Fetching books
Fetching genres
Seeding completed on genres Collection 9/30/2021, 10:29:10 AM
Seeding completed on books Collection 9/30/2021, 10:39:40 AM

Connect to the application

Now you can try out the application by browsing to the app service URL.

You can find the URL in the overview section of the App Service resource created by the deployment template. Cosmos Bookstore Main page

Setup Azure Search Integration

Optionally, you can setup Azure Search integration to try out the full text functionality in the app.

Azure Search support for Cosmos DB API for MongoDB is currently in preview, so the feature will explicitly need to be enabled for your subscription.

Dataset Credits

The dataset used in this application is "GoodReads 100k books" dataset from Kaggle.

References

License

CosmosDB Bookstore is licensed under the MIT license. See the LICENSE file for more details.

azure-cosmosdb-mongodb-api-nodejs-bookstore's People

Contributors

nayakshweta avatar sajeetharan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.