A Cosmos DB server implementation for testing your applications locally.
by vercelTypeScript
Last 12 weeks · 0 commits
2 of 6 standards met
Repository: vercel/cosmosdb-server. Description: A Cosmos DB server implementation for testing your applications locally. Stars: 176, Forks: 33. Primary language: TypeScript. Languages: TypeScript (96.6%), Shell (2%), JavaScript (1.4%). License: MIT. Latest release: 1.0.0 (7mo ago). Open PRs: 7, open issues: 21. Last activity: 6mo ago. Community health: 50%. Top contributors: nkzawa, dependabot[bot], javivelasco, mglagola, ofhouse, dsschneidermann, dglsparsons, craigandrews, asleire, AndreMaz and others.
Cosmos DB just launched a new feature: Full-text search in Azure Cosmos DB for NoSQL It would be great if this could be implemented in cosmosdb-server as well to replicate production environments as closely as possible. Query functions: FullTextContains In this example, we want to obtain the first 10 results where the phrase "red bicycle" is contained in the property c.text. FullTextContainsAll In this example, we want to obtain first 10 results where the keywords "red" and "bicycle" are contained in the property c.text, but not necessarily together. FullTextContainsAny In this example, we want to obtain the first 10 results where the keywords "red" and either "bicycle" or "skateboard" are contained in the property c.text. FullTextScore In this example, we want to obtain the first 10 results where "mountain" and "bicycle" are included, and sorted by order of relevance. That is, documents that have these terms more often should appear higher in the list.
Changes We are testing with v3.17.3 instead of v3.10.x. The reason for that is that we need v3.15.x to support Patch operations, and since we are already updating the library, I have bumped it to the latest 3.X version, which is maintenance mode (they are already in the version v4.5+). Bumping to version v4.X should be another PR as it is a breaking change and more risky. In this PR I am only interested in adding support for the Patch operations. Another change is supporting Node 20 and 22 in the test matrix. We are also removing support for Node 14, 16 and 18, as they have reached their EOL and the new version from does not support that. Removing this support means it is a BREAKING CHANGE. The default NodeJS version has been moved from Node 14 to Node 20. What is Patch updates? Patch (Partial) updates allow us to only modify the fields that have changed from a CosmosDB document. Otherwise, the default behavior is to delete and create the Document again, which means the RU consumption increases in proportion to the Document size and we introduce more latency. Testing I have added integration tests to support the all patch operations, even if in the end we will only use three operations: , , . The main reason is that the main tests from azure SDK try all patch operations, and we want to pass them. There is also an additional test to verify that the condition works, if used. Also, I had to update the gitsubmodule used for testing to the latest one, due to errors and issues with all the previous versions.