Kdog
Kdog

Reputation: 296

How do you perform queries without specifying shard key in mongodbapi and how do you query across partitions?

How do you perform queries without specifying shard key in mongodb api and how do you query across partitions?

In sql api the latter is enabled by setting EnableCrossPartitionQuery to true on the request but I'm not able to find anything like that for the mongodb api. And my queries that work on an unsharded collection now fails(queries that specify the shard key works as expected).

The queries fail indiscriminately of whether I use the AsQueryable extension syntax or the aggregation framework.

Upvotes: 0

Views: 574

Answers (2)

Kdog
Kdog

Reputation: 296

Was confirmed a bug by the Product Group team! Will be fixed in first two weeks of september in case anyone runs into the same problems in the mean time.

Upvotes: 1

Jay Gong
Jay Gong

Reputation: 23782

As I know, no such property similar to EnableCrossPartitionQuery in CosmosDB Mongo API. In fact, CosmosDB is an independent server implementation that does not directly align with MongoDB server versions and features.

CosmosDB supports a subset of the MongoDB API and translates requests into the CosmosDB SQL equivalent. CosmosDB has some different behaviours and results, particularly with their implementation of partitioning as compared to MongoDB's sharding. But the onus is on CosmosDB to improve their emulation of MongoDB.

Certainly, you could add feedback here to get official assistance or consider using MongoDB Atlas on Azure if you'd like full MongoDB feature support.

Hope it helps you.

Upvotes: 2

Related Questions