question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MongoDB Search Strategy

See original GitHub issue

Is your feature request related to a problem? Please describe.

Due to the DefaultSeachPlugin within @vendure/core not having an implemented MongoDB Search Strategy, even if I configure VendureConfig correctly using the TypeORM MongoDB Connection settings (as mentioned in https://github.com/vendure-ecommerce/vendure/issues/132#issuecomment-517197724 from 2019), I still receive the following error.

sean@pop-os:~/temp/e2e-vendure/project-name$ npm run start

> project-name@0.1.0 start
> concurrently yarn:run:*

yarn run v1.22.17
yarn run v1.22.17
$ ts-node ./src/index-worker.ts
$ ts-node ./src/index.ts
[run:worker] info 01/11/21, 16:43 - [Vendure Worker] Bootstrapping Vendure Worker (pid: 6183)... 
[run:server] info 01/11/21, 16:43 - [Vendure Server] Bootstrapping Vendure Server (pid: 6191)... 
[run:worker] error 01/11/21, 16:43 - [ExceptionHandler] error.database-not-supported-by-default-search-plugin
[run:worker] Error: error.database-not-supported-by-default-search-plugin
[run:worker]     at FulltextSearchService.setSearchStrategy (/home/sean/temp/e2e-vendure/project-name/node_modules/@vendure/core/src/plugin/default-search-plugin/fulltext-search.service.ts:125:23)
[run:worker]     at new FulltextSearchService (/home/sean/temp/e2e-vendure/project-name/node_modules/@vendure/core/src/plugin/default-search-plugin/fulltext-search.service.ts:44:14)
[run:worker]     at Injector.instantiateClass (/home/sean/temp/e2e-vendure/project-name/node_modules/@nestjs/core/injector/injector.js:286:19)
[run:worker]     at callback (/home/sean/temp/e2e-vendure/project-name/node_modules/@nestjs/core/injector/injector.js:42:41)
[run:worker]     at processTicksAndRejections (internal/process/task_queues.js:95:5)
[run:worker]     at async Injector.resolveConstructorParams (/home/sean/temp/e2e-vendure/project-name/node_modules/@nestjs/core/injector/injector.js:114:24)
[run:worker]     at async Injector.loadInstance (/home/sean/temp/e2e-vendure/project-name/node_modules/@nestjs/core/injector/injector.js:46:9)
[run:worker]     at async Injector.loadProvider (/home/sean/temp/e2e-vendure/project-name/node_modules/@nestjs/core/injector/injector.js:68:9)
[run:worker]     at async Promise.all (index 3)
[run:worker]     at async InstanceLoader.createInstancesOfProviders (/home/sean/temp/e2e-vendure/project-name/node_modules/@nestjs/core/injector/instance-loader.js:43:9) 
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[run:worker] yarn run run:worker exited with code 1
[run:server] error 01/11/21, 16:43 - [ExceptionHandler] error.database-not-supported-by-default-search-plugin
[run:server] Error: error.database-not-supported-by-default-search-plugin
[run:server]     at FulltextSearchService.setSearchStrategy (/home/sean/temp/e2e-vendure/project-name/node_modules/@vendure/core/src/plugin/default-search-plugin/fulltext-search.service.ts:125:23)
[run:server]     at new FulltextSearchService (/home/sean/temp/e2e-vendure/project-name/node_modules/@vendure/core/src/plugin/default-search-plugin/fulltext-search.service.ts:44:14)
[run:server]     at Injector.instantiateClass (/home/sean/temp/e2e-vendure/project-name/node_modules/@nestjs/core/injector/injector.js:286:19)
[run:server]     at callback (/home/sean/temp/e2e-vendure/project-name/node_modules/@nestjs/core/injector/injector.js:42:41)
[run:server]     at processTicksAndRejections (internal/process/task_queues.js:95:5)
[run:server]     at async Injector.resolveConstructorParams (/home/sean/temp/e2e-vendure/project-name/node_modules/@nestjs/core/injector/injector.js:114:24)
[run:server]     at async Injector.loadInstance (/home/sean/temp/e2e-vendure/project-name/node_modules/@nestjs/core/injector/injector.js:46:9)
[run:server]     at async Injector.loadProvider (/home/sean/temp/e2e-vendure/project-name/node_modules/@nestjs/core/injector/injector.js:68:9)
[run:server]     at async Promise.all (index 3)
[run:server]     at async InstanceLoader.createInstancesOfProviders (/home/sean/temp/e2e-vendure/project-name/node_modules/@nestjs/core/injector/instance-loader.js:43:9) 
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[run:server] yarn run run:server exited with code 1
sean@pop-os:~/temp/e2e-vendure/project-name$ 

Looking at #505 I could modify the following line so I no longer get the error.database-not-supported-by-default-search-plugin error, although that doesn’t add the functionality magically.

https://github.com/vendure-ecommerce/vendure/blob/3460536121b43e188824d38321dfe7f59795e740/packages/core/src/plugin/default-search-plugin/fulltext-search.service.ts#L110-L128

Describe the solution you’d like A MongoDB Search Strategy be implemented within @vendure/core’s DefaultSeachPlugin.

Describe alternatives you’ve considered Being pointed to an already existing implementation of this, or a neat work around. Failing all of the above, I can just hackily change the switch case.

Additional context N/A

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
Sean12697commented, Nov 3, 2021

If you know what either TypeORM doesn’t cover, or what you’ve had to write on top of / extend TypeORM for custom functions (like the Search Strategies, where you’ve written implementations for mariadb, better-sqlite3 and postgres), I would be interested in looking into what it would take to make MongoDB reach the minimum compatibility level to function.

0reactions
michaelbromleycommented, Nov 3, 2021

Just had a look through the TypeORM issues and it seems like the MongoDB driver does not support:

which are absolute show-stoppers right there. Unless those features get proper support, there’s basically no possibility that Vendure will work with Mongo.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Full-Text Search and How Does it Work? - MongoDB
Full-text search refers to searching some text inside extensive text data stored electronically and returning results that contain some or all of the...
Read more >
How To Perform Full-text Search in MongoDB - DigitalOcean
How To Perform Full-text Search in MongoDB · Step 1 — Preparing the Test Data · Step 2 — Creating a Text Index...
Read more >
Strategies for fast searches of billions of small documents in ...
How can we manage larger data sets, when we cannot store an entire index in RAM? Will MongoDB perform better if we combine...
Read more >
Handling Slow Queries in MongoDB - Part 2: Solutions - Rockset
When you know the queries ahead of time that you're looking to speed up, you can create indexes from within MongoDB on the...
Read more >
How to Build an Effective MongoDB Index Strategy
Those who use MongoDB on a regular basis to gather and store large amounts of data will find its ability to create indexes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found