File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,9 @@ async function main() {
1010 /**
1111 * The Mongo Client you will use to interact with your database
1212 * See https://mongodb.github.io/node-mongodb-native/3.6/api/MongoClient.html for more details
13+ * In case: '[MONGODB DRIVER] Warning: Current Server Discovery and Monitoring engine is deprecated...'
14+ * pass option { useUnifiedTopology: true } to the MongoClient constructor.
15+ * const client = new MongoClient(uri, {useUnifiedTopology: true})
1316 */
1417 const client = new MongoClient ( uri ) ;
1518
@@ -89,14 +92,14 @@ async function findListingsWithMinimumBedroomsBathroomsAndMostRecentReviews(clie
8992 if ( results . length > 0 ) {
9093 console . log ( `Found listing(s) with at least ${ minimumNumberOfBedrooms } bedrooms and ${ minimumNumberOfBathrooms } bathrooms:` ) ;
9194 results . forEach ( ( result , i ) => {
92- date = new Date ( result . last_review ) . toDateString ( ) ;
95+ const date = new Date ( result . last_review ) . toDateString ( ) ;
9396
9497 console . log ( ) ;
9598 console . log ( `${ i + 1 } . name: ${ result . name } ` ) ;
9699 console . log ( ` _id: ${ result . _id } ` ) ;
97100 console . log ( ` bedrooms: ${ result . bedrooms } ` ) ;
98101 console . log ( ` bathrooms: ${ result . bathrooms } ` ) ;
99- console . log ( ` most recent review date: ${ new Date ( result . last_review ) . toDateString ( ) } ` ) ;
102+ console . log ( ` most recent review date: ${ date } ` ) ;
100103 } ) ;
101104 } else {
102105 console . log ( `No listings found with at least ${ minimumNumberOfBedrooms } bedrooms and ${ minimumNumberOfBathrooms } bathrooms` ) ;
You can’t perform that action at this time.
0 commit comments