[X] I added a very descriptive title to this issue.
[X] I searched the LangChain documentation with the integrated search.
[X] I used the GitHub search to find a similar question and didn't find it.
[X] I am sure that this is a bug in LangChain rather than my code.
[X] The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
vectorstore = DocumentDBVectorSearch.from_connection_string(
connection_string=connection_string,
namespace=namespace,
embedding=embeddings,
index_name=INDEX_NAME,
)
# calling similarity_search without filter, makes filter get the default value None and
docs = vectorstore.similarity_search(query=keyword)
Error Message and Stack Trace (if applicable)
Error message: the match filter must be an expression in an object, full error: {'ok': 0.0, 'code': 15959, 'errmsg': 'the match filter must be an expression in an object', 'operationTime': Timestamp(1722245629, 1)}.
Description
I am trying to use AWS DocumentDB as vector database and when I call similarity_search method from a DocumentDBVectorSearch instance, without filter, only query text, DocumentDB returns an error like: "the match filter must be an expression in an object". This is because None $match expressions are not supported and have to be removed from the pipeline when filter is None.
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Error message: the match filter must be an expression in an object, full error: {'ok': 0.0, 'code': 15959, 'errmsg': 'the match filter must be an expression in an object', 'operationTime': Timestamp(1722245629, 1)}.
Description
I am trying to use AWS DocumentDB as vector database and when I call similarity_search method from a DocumentDBVectorSearch instance, without filter, only query text, DocumentDB returns an error like: "the match filter must be an expression in an object". This is because None $match expressions are not supported and have to be removed from the pipeline when filter is None.
System Info
langchain==0.2.11 langchain-aws==0.1.6 langchain-cohere==0.1.9 langchain-community==0.2.10 langchain-core==0.2.23 langchain-experimental==0.0.63 langchain-openai==0.1.17 langchain-text-splitters==0.2.2
platform=mac python=3.12.4