Skip to content

itzdarsh/MongoAFTS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 

Repository files navigation

MongoAtlas Full Text Search

Download the zip and unzip it:

├── README.md
├── backend
│   ├── main.js
│   ├── package-lock.json
│   └── package.json
├── frontend
│   ├── index.html
│   ├── node_modules
└── package-lock.json

Directory structure.

Create Atlas Cluster in cloud.mongodb.com atleast M0.

Load Sample Data

Create Atlas Search Index with below definition:

{
  "mappings": {
    "dynamic": false,
    "fields": {
      "fullplot": [
        {
          "type": "string"
        }
      ],
      "title": [
        {
          "type": "autocomplete"
        }
      ]
    }
  }
}

Setting up backend:

  1. cd MongoAFTS/backend
  2. npm init
  3. vi main.js edit the MongoDB connectivity Atlas connection string in the MongoClient() constructor.
  4. node main.js

hit localhost:3000 (search in server.listen() method if not 3000)

Setting up frontend: Simple and Easy step is host the index.html in realm

If not you can host in your system:

  1. cd ../frontend
  2. npm install serve
  3. npx serve

Follow the link that above command display

It will open an webpage where you can search title of the movie, you will get autocomplete option to select the desired movie once you select any movie name it will display details about it.

About

Demostration of Atlas Full text search

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published