Comments (8)
@nkzawa FYI there is a JS version of this file as well which may help https://github.com/Azure/azure-cosmos-js/blob/c1be5cc0fcc80670ae6c2a6b5f133530e7889db9/src/common/resourceId.ts
In practice, the JS SDK doesn't use any of this information which is why it was later removed
from cosmosdb-server.
I am not sure but I think you'll be fine with how you are doing it in the PR. The ResourceId just cares about the structure to determine the type of resource it is talking to. I don't think you need to worry about the exact behavior of writing new docs on _rid
from cosmosdb-server.
I found that there's another Java SDK, where source is provided and the RID parse implementation is similar: https://github.com/Azure/azure-cosmosdb-java/blob/v2.6.0/commons/src/main/java/com/microsoft/azure/cosmosdb/internal/ResourceId.java.
from cosmosdb-server.
Thanks for the report! Actually, we just create random strings with a few rules for now, since I was not sure how they should be constructed. The tryParse
code is very informative and we will be able to fix id generation according to it.
from cosmosdb-server.
@southpolesteve It seems we can almost just copy and apply the file, thank you.
Btw, do you know how exactly each "id" is assigned on database? As far as I observed, _rid
is incremented as base64 when new documents are created like the following.
1: "wkc8APV7cAAFAAAAAAAAAA=="
2: "wkc8APV7cAAGAAAAAAAAAA==" // "F" to "G"
3: "wkc8APV7cAAHAAAAAAAAAA==" // "G" to "H"
...
If you increment document
id as an integer, it doesn't become like that 🤔
const id = new ResouceId();
id.database = "1";
id.documentCollection = "1"
id.document = "1";
console.log(id.toString()); // 'AAAAAQAAAAEAAAAAAAAAAQ=='
// for the next document (wrong)
id.document = "2";
console.log(id.toString()); // 'AAAAAQAAAAEAAAAAAAAAAg=='
from cosmosdb-server.
@badeball sorry for the delay. The problem should be fixed on the latest version 0.2.10
. Let me know it didn't work for you.
from cosmosdb-server.
Hmm, I can't seem to perform any query using the Java SDK. It fails on the read-collection-endpoint, where it is provided with dbId=AAAAAQ==
and collId=AAAAAQ==
. This happens when I create the database and collection using the Node SDK and attempting to query it using the Java SDK.
Here's the stack trace, if it's of any interest.
java.lang.IllegalStateException: java.util.concurrent.ExecutionException: java.lang.IllegalStateException: com.microsoft.azure.documentdb.DocumentClientException: null, StatusCode: NotFound
at com.microsoft.azure.documentdb.internal.routing.CollectionCache.resolveByRid(CollectionCache.java:132)
at com.microsoft.azure.documentdb.internal.routing.CollectionCache.resolveCollection(CollectionCache.java:49)
at com.microsoft.azure.documentdb.internal.SessionContainer.resolvePartitionKeyRange(SessionContainer.java:217)
at com.microsoft.azure.documentdb.internal.SessionContainer.resolveSessionToken(SessionContainer.java:123)
at com.microsoft.azure.documentdb.DocumentClient.applySessionToken(DocumentClient.java:3222)
at com.microsoft.azure.documentdb.DocumentClient.doQuery(DocumentClient.java:3143)
at com.microsoft.azure.documentdb.DocumentQueryClientInternal.doQuery(DocumentQueryClientInternal.java:47)
at com.microsoft.azure.documentdb.internal.query.AbstractQueryExecutionContext.executeRequest(AbstractQueryExecutionContext.java:219)
at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.executeOnce(DefaultQueryExecutionContext.java:159)
at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.fillBuffer(DefaultQueryExecutionContext.java:99)
at com.microsoft.azure.documentdb.internal.query.DefaultQueryExecutionContext.hasNext(DefaultQueryExecutionContext.java:71)
at com.microsoft.azure.documentdb.internal.query.ProxyQueryExecutionContext.<init>(ProxyQueryExecutionContext.java:67)
at com.microsoft.azure.documentdb.internal.query.QueryExecutionContextFactory.createQueryExecutionContext(QueryExecutionContextFactory.java:23)
at com.microsoft.azure.documentdb.QueryIterable.createQueryExecutionContext(QueryIterable.java:70)
at com.microsoft.azure.documentdb.QueryIterable.reset(QueryIterable.java:115)
at com.microsoft.azure.documentdb.QueryIterable.<init>(QueryIterable.java:57)
at com.microsoft.azure.documentdb.DocumentClient.queryDocuments(DocumentClient.java:1167)
at com.microsoft.azure.documentdb.DocumentClient.queryDocuments(DocumentClient.java:1138)
from cosmosdb-server.
@badeball Thank you again for the report. Not sure why but maybe Java client is stricter or something on other parts too. I created the issue for it.
from cosmosdb-server.
Related Issues (20)
- Is this compatible with CosmosClient on an ASP.net Core application? HOT 3
- Query to //addresses/?$resolveFor=dbs&$filter=protocol%20eq%20rntbd HOT 3
- Support for C# SDK v3 HOT 5
- Docker image HOT 11
- Upsert responding with "Resource with specified id or name already exists."
- Project has no license file HOT 2
- Bad Request when GET request includes document header x-ms-documentdb-isquery
- Exception in read-document.ts getCollectionPartitionKeys when collection has no partitionKey saved
- Feature request: add externalized configuration for certificates and logging
- Support .NET client HOT 2
- read-meta hardcoded to port 3000 HOT 1
- GetItemLinqQueryable ... ToFeedIterator invalid response from queryDocuments HOT 3
- Query triggers `Unexpected token '.'` HOT 2
- Query triggers `"Invalid destructuring assignment target"`
- Gremlin/Graph support
- When using in azure function, it always tries calls https even when --no-ssl is set HOT 2
- When running cosmosdb-server alongside a azure function in a docker project, the function app wont connect to the server
- When querying from a azure function using input binding, a query plan request is made that is not mapped HOT 1
- Is server do not support patch operation? HOT 1
- GROUP BY
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cosmosdb-server.