Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use the new "search" pipeline? #317

Closed
alexbjorlig opened this issue Jun 11, 2020 · 14 comments
Closed

Is it possible to use the new "search" pipeline? #317

alexbjorlig opened this issue Jun 11, 2020 · 14 comments

Comments

@alexbjorlig
Copy link

I would love to use the new full-text search options when testing our application. When trying to do this with the mongodb-memory-server, we get the following error:

Error: GraphQL error: Unrecognized pipeline stage name: '$search'

Would this somehow be possible - or do we have to give-up testing of full-text search?

Versions

  • NodeJS: 14
  • mongodb-memory-server-*: 6.2.4
  • system:MacOS

mongo-memory-server

@DilipCoder
Copy link

$set is also missing from aggregation stage

Versions:
"mongodb-memory-server": "^6.6.1",
system: ubuntu 18.04

@hasezoey
Copy link
Member

please provide which mongodb version is being used

@alexbjorlig you might need to wrap it in an $text first ({ $text: { $search: "something" } })

@DilipCoder what do you mean that $set is not available?

@alexbjorlig
Copy link
Author

@hasezoey in our project we use "mongodb-memory-server": "^6.2.4", when testing. The full text search is available on atlas running MongoDB 4.2.

@hasezoey
Copy link
Member

hasezoey commented Jul 24, 2020

@alexbjorlig i asked for the version of mongodb(node_modules/.cache/mongodb-memory-server/mongodb-binaries/<version>/mongod / the version that gets logged), not the package version

and are you sure this is not an atlas-only feature?

@alexbjorlig
Copy link
Author

@hasezoey - I'm sorry. I don't have the .cache directory in my node_modules? I just checked, and full-text search is an atlas-only feature. So I guess that closes the issue. I will cover this area in our test environment in a different way then.

@hasezoey
Copy link
Member

@alexbjorlig that is just the default location, it might be globally installed when -global package is used, or when an custom path is given

@alexfoxy
Copy link

I have this issue running my tests. Error received is: MongoError: Unrecognized pipeline stage name: '$search'.

mongo db version: 4.2.7
mongodb-memory-server: 6.6.3
mongoose: 5.9.28

The query runs fine when running the application. Query is as follows:

  const documents = await model.aggregate([
    {
      $search: {
        'text': {
          'query': searchTerm,
          'path': paths,
        },
      },
    },
    {
      $match: query,
    },
  ]).limit(limit)
    .skip(skip)
    .sort({ score: { $meta: 'textScore' } })

@alexfoxy
Copy link

Interestingly this is within my binaries folder:

ls node_modules/.cache/mongodb-memory-server/mongodb-binaries/ 
4.0.14                  4.0.14.lock.STALE       4.0.3                   4.0.3.lock.STALE

so mongodb-memory-server does not use your global version?

@hasezoey
Copy link
Member

hasezoey commented Aug 13, 2020

@alexfoxy when you mean system-installed binary, no this package dosnt without config for it, if you use the normal package the binary gets stored in node_modules/.cache and if using the global version then in ~/.cache/mongodb-binaries

if you want to use the system-binary, you need to set option binary.systemBinary

PS: are you sure you want to use $search on top-level, and not within an $text? could you give me an documentation link where this is documented?

@alexfoxy
Copy link

@alexfoxy
Copy link

@hasezoey I'm also wondering now if this is unsupported then? For my tests I will have to think of a work around..

@hasezoey
Copy link
Member

@alexfoxy from what it seems, it is an atlas-exclusive feature

@johnrb2
Copy link

johnrb2 commented Jan 24, 2024

Since there is now a local version of atlas available, will you be updating mongodb-memory-server to support Atlas Search?

@hasezoey
Copy link
Member

hasezoey commented Jan 25, 2024

@johnrb2 to my current knowledge, this "local atlas deployment" requires its own cli-tool and podman, which are requirements i would not like to currently add to MMS.
If anything it would at the very least be another class altogether (like MongoMemoryReplSet and MongoMemoryServer, along the lines of MongoMemoryAtlas)

PS: as this issue is old, and "local atlas deployment" will likely still evolve a bit (because it is in preview); see #849 instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants