question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot retrieve MongoDB information

See original GitHub issue

Describe the bug

Command Name az cosmosdb mongodb database

Errors:

The operation 'azure.mgmt.cosmosdb.operations#MongoDBResourcesOperations.delete_mongo_db_database' is invalid.
Traceback (most recent call last):
azure/cli/core/__init__.py, ln 831, in get_op_handler
    op = getattr(op, part)
AttributeError: type object 'MongoDBResourcesOperations' has no attribute 'delete_mongo_db_database'

...

azure/cli/core/__init__.py, ln 836, in get_op_handler
    raise ValueError("The operation '{}' is invalid.".format(operation))
ValueError: The operation 'azure.mgmt.cosmosdb.operations#MongoDBResourcesOperations.delete_mongo_db_database' is invalid.

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

  • Put any pre-requisite steps here…
  • az cosmosdb mongodb database --help

Expected Behavior

Environment Summary

Linux-5.13.0-28-lowlatency-x86_64-with-glibc2.34
Python 3.9.7
Installer: DEB

azure-cli 2.18.0 *

Extensions:
azure-devops 0.19.0

Additional Context

Hello,

I am currently working on automating my infrastructure and trying to create a mongodb. I am creating the mongodb via ASO (Azure Service Operator for Kubernetes). After registering the Microsoft.DocumentDB provider I am still getting errors from the CLI when I try to get information on the database that I have created.

Here is an excerpt from my ansible taks which create the mongodb and below the auto generated report from az feedback

- name: Ensure resource group is {{ state }}.
  k8s:
    namespace: faasaf-playground-{{ app_version }}
    kubeconfig: "{{ playbook_dir }}/../.kube/{{ location }}_config"
    state: "{{ state }}"
    definition:
      apiVersion: resources.azure.com/v1alpha1api20200601
      kind: ResourceGroup
      metadata:
        name: faasaf-playground-{{ location }}
      spec:
        location: "{{ location }}"
  tags:
    - faasaf
    - faasaf.faasaf.io

- name: Ensure MondoDB account is {{ state }}.
  k8s:
    namespace: faasaf-playground-{{ app_version }}
    kubeconfig: "{{ playbook_dir }}/../.kube/{{ location }}_config"
    state: "{{ state }}"
    definition:
      apiVersion: documentdb.azure.com/v1alpha1api20210515
      kind: DatabaseAccount
      metadata:
        name: faasaf-db-account
      spec:
        location: "{{ location }}"
        owner:
          name: faasaf-playground-{{ location }}
        kind: MongoDB
        databaseAccountOfferType: Standard
        locations:
          - locationName: "{{ location }}"
  tags:
    - faasaf
    - faasaf.faasaf.io

- name: Ensure MondoDB database is {{ state }}.
  k8s:
    namespace: faasaf-playground-{{ app_version }}
    kubeconfig: "{{ playbook_dir }}/../.kube/{{ location }}_config"
    state: "{{ state }}"
    definition:
      apiVersion: documentdb.azure.com/v1alpha1api20210515
      kind: MongodbDatabase
      metadata:
        name: faasaf-db-mongodb
      spec:
        location: "{{ location }}"
        owner:
          name: faasaf-db-account
        options:
          autoscaleSettings:
            maxThroughput: 4000
        resource:
          id: faasaf-db-mongodb
  tags:
    - faasaf
    - faasaf.faasaf.io

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
khusseinicommented, Feb 9, 2022

I guess since the command that I need (az cosmosdb mongodb database show) is working, I can close this ticket. Seems to be some weird edgecase on my machines.

0reactions
SaurabhSharma-MSFTcommented, Feb 8, 2022

@khusseini I have tried running az cosmosdb mongodb database --help and it works fine with the below response.
image

What exactly you are trying to do with this cmdlet output? Did you try running this cmdlet directly into your target machine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting error while connecting node and mongo as cannot GET
Hello everyone I'm trying to connect mongo and node. But i'm getting cannot GET Please help me with this My code is as...
Read more >
Unable to connect with node.js due to "mongodb+srv"
I'm having the EXACT same error as Getting error upon await client.connect() in node.JS and Error with await client.connect() node.JS.
Read more >
Troubleshoot Connection Issues — MongoDB Atlas
If you are using a mongodb+srv:// connection string and your driver or shell can't find the DNS host of the Atlas database deployment,...
Read more >
Cant find doc right after creation - Working with Data - MongoDB
Hi. I recently faced a problem below: When I create doc, mongo returns me info about inserted doc. I take the id and...
Read more >
I suddenly became unable to connect to mongodb with shell ...
Hello everyone, I have been using mongoDb for quite a while. And only a few days ago I was able to dump mongodb....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found