Skip to content

Instantly share code, notes, and snippets.

@Jviejo
Created November 2, 2021 13:47
Show Gist options
  • Save Jviejo/c758f9001665defcac971152a6b2feaa to your computer and use it in GitHub Desktop.
Save Jviejo/c758f9001665defcac971152a6b2feaa to your computer and use it in GitHub Desktop.
var url = "mongodb+srv://database:aqui va la password@ip/myFirstDatabase?retryWrites=true&w=majority"
var MongoClient = require('mongodb').MongoClient;
MongoClient.connect(url, function(err, client) {
if (err){
console.log(err);
return;
}
var db = client.db('data');
var cursor = db.collection('ciudades').find();
cursor.forEach(function(doc, err) {
if (err) {
console.log(err);
return;
}
console.log(doc);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment