TypeError: object of type 'ServerSelectionTimeoutError' has no len()

cada vez que ejecuto el test Projection tengo este resultado…si alguien tiene una idea por favor su ayuda:

Mi codigo es la siguiente: lo ejecute en Jupyter y si devuelve la lista que solicitan…

cursor=db.movies.find( { “countries”: {"$in":countries }},{"_id":1,“title”:1})
return list(cursor)

Si alguien me da una sugerencia estare agradecido

Saludos

Atlas Cluster0-shard-0 [primary] sample_mflix> db.movies.find({"countries":{"$in":["USA"]}},{"title": 1,"_id": 0});
[
  { title: 'Blacksmith Scene' },
  { title: 'The Great Train Robbery' },
  { title: 'The Land Beyond the Sunset' },
  { title: 'A Corner in Wheat' },
  {
    title: 'Winsor McCay, the Famous Cartoonist of the N.Y. Herald and His Moving Comics'
  },
  { title: 'Traffic in Souls' },
  { title: 'Gertie the Dinosaur' },
  { title: 'In the Land of the Head Hunters' },
  { title: 'The Perils of Pauline' },
  { title: 'The Birth of a Nation' },
  { title: 'The Cheat' },
  { title: 'The Italian' },
  { title: 'Regeneration' },
  { title: 'Civilization' },
  { title: "Hell's Hinges" },
  { title: "Intolerance: Love's Struggle Throughout the Ages" },
  { title: 'Where Are My Children?' },
  { title: 'The Immigrant' },
  { title: 'The Poor Little Rich Girl' },
  { title: 'Wild and Woolly' }
]
Type "it" for more

The TypeError indicates that your code throws an exception before your

return list(cursor)

The ServerSelectionTimeoutError indicates that you are not connected to your cluster.

Have you executed the connection tests? Is your cluster up and running? Did you change network location and your new IP address is not in the allowed list?

ok I found it, my problem was in the .ini file… I hadn’t completed the url for the test… Thanks

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.