Azure Cosmos DB databases can be configured to use the MongoDB API. Via this feature Cosmos DB aims to provide a compatible server interface for applications using the MongoDB wire protocol. Since Cosmos DB is a distinct implementation from MongoDB server, some server commands may not be supported yet or may differ in behavior.
Questions tagged [azure-cosmosdb-mongoapi]
437 questions
26
votes
9 answers
SSL Handshake issue with Pymongo on Python3
Trying to connect to Azure CosmosDB mongo server results into an SSL handshake error.
I am using Python3 and Pymongo to connect to my Azure CosmosDB. The connection works fine if I run the code with Python27 but causes the below error when using…

abhinav singh
- 1,024
- 1
- 12
- 34
19
votes
3 answers
High demand on Azure Cosmos DB Emulator when adding a new collection
When I'm trying to add a new collection to database I'm getting this error :
Failed to create collection 'Products'.
Error:
Sorry, we are currently experiencing high demand in this region, and cannot
fulfill your request at this time. We work…

Nicu Besliu
- 453
- 5
- 17
15
votes
3 answers
Azure Cosmos DB: 'Request rate is large' for simple count query
I'm using Cosmos DB with the Mongo adapter, accessing via the Ruby mongo driver. Currently there are about 2.5M records in the db.
When querying the total amount of records, there's no problem whatsoever:
2.2.5 :011 > mongo_collection.count
D,…

bramj
- 151
- 1
- 1
- 4
13
votes
3 answers
Using the sort() cursor method without the default indexing policy in Azure Cosmos DB for MongoDB API
With Cosmos DB for MongoDB API (Version 3.4), the following find query in combination with the method cursor sort seems to behave incorrectly:
db.test.find({"field1": "value1"}).sort({"field2": 1})
The error occurs, if all of the following…

Mathias
- 211
- 3
- 10
12
votes
2 answers
Connection to CosmosDB through Mongo API fails after idle
We have a Scala server which uses the Java MongoDB driver as wrapped by Casbah. Recently, we switched its database over from an actual MongoDB to Azure CosmosDB, using the Mongo API. This is generally working fine, however every once in a while a…

Astrid
- 1,808
- 12
- 24
11
votes
3 answers
Getting 'query in command must target a single shard'
I have a CosmosDB setup using the Mongo API. I have a collection with a hashed shard on one of the field of the document. When I run commands like db.collection.remove or db.collection.deleteMany I get the following error.
Command deleteMany…

Zabi
- 845
- 2
- 9
- 15
10
votes
1 answer
How do I connect to the Azure CosmosDB Emulator for MongoDB?
When attempting to connect to the local emulator for Azure CosmosDB with the MongoDB connection string…

halshing
- 612
- 2
- 6
- 17
10
votes
3 answers
How to disable Cosmos DB shard key for Mongo API
I'm migrating a very simple mongo DB (couple 100 entries) to Azure Cosmos DB. My app is based on node-js so I'm using mongoose as a mapper. Before it was really simple, define schema, query collection, finished.
Now when setting up a collection in…

baouss
- 1,312
- 1
- 22
- 52
8
votes
1 answer
How do I change API in cosmosDB?
I have a cosmosDB with mongo API, however there are many features not supported in this API so I want to switch to SQL API?

Jeffrey C
- 364
- 4
- 13
7
votes
1 answer
Mongorestore from localhost to cosmosDb fails with "disable retryable writes by specifying "retrywrites=false"
mongo client v 4.4
mongorestore --host --port 10255 -u -p --db --collection structures structures.bson --ssl --sslAllowInvalidCertificates
2020-10-03T23:13:44.440+0300 Failed: .structures: error…

Nedudi
- 5,639
- 2
- 42
- 37
7
votes
0 answers
Query in command must target a single shard key
I'm trying to insert multiple documents to Cosmos DB with Mongo Api which has a shard key as follows,
insertAll(trips.stream().map(t -> Document.parse(gson.toJson(t))).collect(Collectors.toList()),"trip");
insertAll method is as follows,
private…

Channa
- 3,267
- 7
- 41
- 67
7
votes
4 answers
Mongoose with CosmosDB: Getting error `Shared throughput collection should have a partition key`
I have a node-express application that currently uses Mongoose to connect to MongoDB, and am attempting to migrate it to Azure Cosmos DB.
When I simply allow Mongoose to create the database, the application works fine, however the database is…

alt
- 2,356
- 2
- 21
- 28
6
votes
0 answers
Unable to connect to cosmos db emulator Mongo API 3.6
I am able to connect to the standard MongoAPI 3.2 version with python as well as Robo 3T after executing the startup with the following:
CosmosDb.Emulator.exe /EnableMongoDbEndpoint
However when starting the emulator with:
CosmosDb.Emulator.exe…

Stefan Cronje
- 149
- 2
- 7
6
votes
1 answer
Choosing correct approach to build a muti-tenant architecture with Azure Cosmos DB (MongoDB)
I am little confused in choosing the suitable approach of creating database/collections for a multi-tenant system in MongoDB in CosmosDB API.
I would have 500 tenants for my application, where each tenant's data may grow up to 3-5GB and initially…

Guru Prasad
- 71
- 3
6
votes
3 answers
「 The 'expireAfterSeconds' option is supported on '_ts' field only. 」 error is showed
I use cosmos db for sesseion store in node.js. And cosmos db version is 3.6 .
I execute follwing code.
const expressSession = require("express-session");
const MongoStore = require("connect-mongo")(expressSession);
const store = new MongoStore({
…

Ryusuke Kawasaki
- 63
- 1
- 4