{"id":18398677,"url":"https://github.com/mongodb-developer/google-cloud-semantic-search","last_synced_at":"2026-03-03T23:01:02.990Z","repository":{"id":191338868,"uuid":"683766651","full_name":"mongodb-developer/Google-Cloud-Semantic-Search","owner":"mongodb-developer","description":"Vector search with MongoDB Atlas and Google Cloud","archived":false,"fork":false,"pushed_at":"2024-03-01T16:01:56.000Z","size":2105,"stargazers_count":16,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-07T05:35:37.682Z","etag":null,"topics":["atlas-search","mongodb","mongodb-atlas","vector-search"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mongodb-developer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-08-27T16:29:11.000Z","updated_at":"2024-06-22T06:54:29.000Z","dependencies_parsed_at":"2023-08-29T11:30:28.183Z","dependency_job_id":"633de2ee-2947-4041-85d0-a2136e4fed12","html_url":"https://github.com/mongodb-developer/Google-Cloud-Semantic-Search","commit_stats":null,"previous_names":["mongodb-developer/google-cloud-semantic-search"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mongodb-developer/Google-Cloud-Semantic-Search","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2FGoogle-Cloud-Semantic-Search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2FGoogle-Cloud-Semantic-Search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2FGoogle-Cloud-Semantic-Search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2FGoogle-Cloud-Semantic-Search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mongodb-developer","download_url":"https://codeload.github.com/mongodb-developer/Google-Cloud-Semantic-Search/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mongodb-developer%2FGoogle-Cloud-Semantic-Search/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30064779,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T18:21:05.932Z","status":"ssl_error","status_checked_at":"2026-03-03T18:20:59.341Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["atlas-search","mongodb","mongodb-atlas","vector-search"],"created_at":"2024-11-06T02:23:51.264Z","updated_at":"2026-03-03T23:01:02.973Z","avatar_url":"https://github.com/mongodb-developer.png","language":"JavaScript","readme":"# MongoDB Atlas and Google Cloud Vector Search\n\nThis is a demo of vector search using MongoDB Atlas and Google Cloud. The dataset is a catalogue of books. The project uses Node.js and express for the server and Angular for the client.\n\n## Prerequisites\n\n1. [Node.js](https://nodejs.org/) LTS.\n\n## Setup\n\nFollow the instructions below to run the demo locally.\n\n### Import the dataset into MongoDB Atlas\n\n1. Clone the project.\n\n    ```sh\n    git clone https://github.com/mongodb-developer/Google-Cloud-Semantic-Search\n    ```\n\n1. Navigate to the `prepare-data` directory and install the dependencies.\n\n    ```sh\n    npm install\n    ```\n\n1. Create a free [MongoDB Atlas account](https://www.mongodb.com/try?utm_campaign=devrel\u0026utm_source=cross-post\u0026utm_medium=cta\u0026utm_content=gc-vector-search-demo\u0026utm_term=stanimira.vlaeva).\n\n1. Deploy a free [M0 database cluster](https://www.mongodb.com/docs/atlas/tutorial/deploy-free-tier-cluster/?utm_campaign=devrel\u0026utm_source=cross-post\u0026utm_medium=cta\u0026utm_content=gc-vector-search-demo\u0026utm_term=stanimira.vlaeva) in a region of your choice.\n\n1. Complete the [security quickstart](https://www.mongodb.com/docs/atlas/security/quick-start/?utm_campaign=devrel\u0026utm_source=cross-post\u0026utm_medium=cta\u0026utm_content=gc-vector-search-demo\u0026utm_term=stanimira.vlaeva).\n\n1. Add your [connection string](https://www.mongodb.com/docs/atlas/tutorial/connect-to-your-cluster/?utm_campaign=devrel\u0026utm_source=cross-post\u0026utm_medium=cta\u0026utm_content=gc-vector-search-demo\u0026utm_term=stanimira.vlaeva) to `prepare-data/.env`.   \n   Make sure to replace the placeholders with credentials of the database user you created in the security quickstart.\n\n    **prepare-data/.env**\n    ```\n    ATLAS_URI=\"\u003cyour-connection-string\u003e\"\n    ```\n\n    \u003e Note that you will have to create the file `.env` in the `prepare-data` folder.\n\n1. Run the script for importing the dataset into your database.\n\n    ```sh\n    node ./prepare-data/import-data.js\n    ```\n\n1. Navigate to your MongoDB Atlas database deployment and verify that the data is loaded successfully.\n\n### Generate embeddings\n\n1. Create a new Google Cloud project with billing enabled.\n\n1. Enable the Vertex AI and Cloud Functions APIs.\n\n1. Deploy a public 2nd generation Google Cloud Function with the following implementation:\n    - [Generate embeddings](./google-cloud-functions/generate-embeddings/)\n\n    Replace the `PROJECT_ID` and `LOCATION` placeholders in the file [google-cloud-functions/generate-embeddings/main.py](google-cloud-functions/generate-embeddings/main.py) before deploying the function. Remember to also update the Entry Point to _generate_embeddings_.    \n   \u003e Note: The `LOCATION` parameter defines the region where the cloud function will run, make sure this region supports *VertexAI Model Garden*. `europe-west1` does not. \n   \n    If you have the [`gcloud` CLI](https://cloud.google.com/sdk/docs/install) installed, run the following deployment command.\n\n    ```sh\n    gcloud functions deploy generate-embeddings \\\n      --region=us-central1 \\\n      --gen2 \\\n      --runtime=python311 \\\n      --source=./google-cloud-functions/generate-embeddings/ \\\n      --entry-point=generate_embeddings \\\n      --trigger-http \\\n      --allow-unauthenticated\n    ```\n\n1. Add the deployed function URL to `prepare-data/.env`.\n\n    **prepare-data/.env**\n    ```\n    ATLAS_URI=\"\u003cyour-connection-string\u003e\"\n    EMBEDDING_ENDPOINT=\"\u003cyour-cloud-function-url\u003e\"\n    ```\n\n1. Run the embeddings generation script.\n\n    ```sh\n    node ./prepare-data/create-embeddings.js\n    ```\n\n    \u003e Note that Vertex AI has a limitation for generating 600 embeddings per minute. If you're getting 403 errors, wait for a minute and rerun the script. Repeat until all documents are 'vectorized'.\n\n1. Go back to your MongoDB Atlas project and open the deployed database cluster. Verify that the `bookstore.books` collection has a new `text_embedding` field containing a multi-dimensional vector.\n\n1. Navigate to the _Atlas Search_ Tab and click on _Create Search Index_.\n\n1. Select _JSON Editor_ under Atlas Vector Search and then click on _Next_.\n\n1. Select the Database and Collection and then insert the following index definition and click 'Save'.\n\n    ```json\n    {\n      \"fields\": [\n        {\n          \"numDimensions\": 768,\n          \"path\": \"text_embedding\",\n          \"similarity\": \"euclidean\",\n          \"type\": \"vector\"\n        }\n      ]\n    }\n    ```\n\n### Running the project\n\n1. Navigate to the `server` directory.\n\n1. Copy the `prepare-data/.env`.\n\n    ```\n    cp ../prepare-data/.env .\n    ```\n\n1. Install the dependencies and run the application.\n\n    ```\n    npm install \u0026\u0026 npm start\n    ```\n\n1. Open a new terminal window to run the client application.\n\n1. In the new window, navigate to the `client` directory.\n\n1. Install the dependencies and run the project.\n\n    ```\n    npm install \u0026\u0026 npm start\n    ```\n\n1. Open the browser at `localhost:4200` and find books using the power of vector search!\n\n## Disclaimer\n\nUse at your own risk; not a supported MongoDB product\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongodb-developer%2Fgoogle-cloud-semantic-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmongodb-developer%2Fgoogle-cloud-semantic-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmongodb-developer%2Fgoogle-cloud-semantic-search/lists"}