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
1
vote
0 answers
Getting MongoServerSelectionError in localhost
I have a node.js application deployed in Azure which connects to Azure CosmosDB (MongoDb database).
To connect to to mongo-db i use this code
const options = {
useUnifiedTopology: true,
useNewUrlParser: true,
}
client =…

Coder
- 39
- 6
1
vote
0 answers
how to add new field with many data in that field in MongoCosmosDB
I would like to add new field into json already have in mongoDB Cosmos like this
{
"_id" : "6396cde306fd2d1088d584e4",
"userName" : "user-20526"
}
Now I would like to add a others field like this bellow userName field:
{
"_id" :…

Jin
- 1,259
- 1
- 12
- 24
1
vote
1 answer
MongoDB multi-document transaction: MongoQueryException (Transaction is not active)
I'm testing simple use case for multi-document transactions.
But the context is more specific.
I'm using Azure Cosmos DB with MongoDB API 4.0.
This is the sample code (I want to make this work using MongoRepository interface):
@Transactional(value =…

solujic
- 924
- 1
- 18
- 43
1
vote
1 answer
Using CosmosDB as a key-value store with Golang
I'm trying to figure out the best way to use a key-value store from Golang in a Microsoft Azure environment and understand that CosmosDB can provide that, but I'm a little confused on how to best consume that. One thing that I'd really like is the…

Harmon Herring
- 45
- 7
1
vote
0 answers
Real time data sync between azure cosmos db( with mongo api) and elastic search
In our stack there is both Azure Cosmos DB(with Mongo Api) as well as Elastic search with similar indices. The cosmos DB gets updated frequently with some apis running in the backend. This update also needs to get reflected in elastic search which…

Amar
- 11
- 1
1
vote
0 answers
How to declare an array of array in c# mongo db models?
I am making a function using Azure Functions and Azure Cosmos db (mongo db api) and i need to make a model for the data. One of the fields need to be a array of array but I cant find how to declare an array of array for a method
This is my…

Muskan
- 11
- 1
1
vote
2 answers
Azure Cosmos Mongo API version 3.6 but cannot connect with mongo.cosmos.azure.com:443
I'm trying to connect to a Java application for change feed.
new CosmosClientBuilder().endpoint(ENDPOINT).key(KEY).buildAsyncClient();
The server version is 3.6 but when I try to give ENDPOINT as https://myproject.mongo.cosmos.azure.com:443 it is…

1729i
- 57
- 1
- 5
1
vote
1 answer
Easy way to delete all documents in cosmosdb with mongodb api
What is the easiest way to delete all documents in the container in cosmosdb with mongodb api? Can I do it directly from AZURE portal?

mike zenon
- 31
- 4
1
vote
0 answers
Azure CosmosDB MongoDB Api GeoSpatial queries not working
I have CosmosDB MongoDB-API instance.
Mongo server version = 4.0.0
Inserted documents look like:
{
"_id": "111",
"fileName": "some.txt",
"type": "ONE",
"location": {
"type": "MultiPoint",
"coordinates": [
…

Dmitry D
- 13
- 3
1
vote
1 answer
Connecting FIWARE Orion with Azure Cosmos DB
I tried using FIWARE Orion [1] and for the database I used Azure Cosmos DB Mongo API. I followed the steps as outlined in the issue [2]. The contents of the file docker-compose.yml are:
version: "3"
services:
orion:
image: fiware/orion
…

anupam
- 91
- 1
- 10
1
vote
1 answer
How to connect to an Azure CosmoDB for MongoDB from an Azure Function
I'm starting in Azure Function & Cosmo DB.
I created in the Azure Portal a function app, then I followed the guide to get started in VS Code:
npm install -g azure-functions-core-tools@4 --unsafe-perm true
Then New Project
Then New function, selected…

J4N
- 19,480
- 39
- 187
- 340
1
vote
2 answers
Creating unique index for CosmosDB with MongoDB API fails
I'm using Azure CosmosDB with the MongoDB API. I'm trying to execute the following:
db.createCollection('test')
db.test.createIndex({key: 1}, {name: 'key_1', unique: true})
However, doing so fails with the following error:
The unique index cannot…

g00glen00b
- 41,995
- 13
- 95
- 133
1
vote
0 answers
How to automatically expire documents, based on a field's value, with Azure Cosmos DB API?
I have a collection in cosmos db and I need to implement TTL based on its "expiration" field, which is a date. My documents should expire 7 days post the expiration date. According to documentation, cosmos db api limits the ability to do so. I want…

Rashnee
- 11
- 1
1
vote
0 answers
Azure cosmos DB Data migration tool getting error when verifying Connection string
I currently have an azure cosmos db that i want to export file from. I am using the Azure cosmos DB Data migration tool for this process and on the first screen i am trying to verify my connection string to the db but am getting the following…

keshav
- 31
- 5
1
vote
1 answer
How to copy data from Cosmos DB API for MongoDB to another Cosmos DB account
How to copy data, one collection, from one Cosmos DB API for MongoDB account to another Cosmos DB API for MongoDB account, in another subscription, placed in another Azure region.
Preferably do it periodically.

Michael Chudinov
- 2,620
- 28
- 43