Created
November 2, 2021 13:47
-
-
Save Jviejo/c758f9001665defcac971152a6b2feaa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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