Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
607 B
1
Indexable
Never
const MongoClient = require('mongodb').MongoClient;
const url = 'mongodb://localhost:27017/';

MongoClient.connect(url, function(err, db) {
  if (err) throw err;
  var dbo = db.db("myanilist");
  // https://docs.mongodb.com/manual/reference/sql-comparison/
  dbo.collection("profile").find(
    { description: "Description for testing" }, 
    { projection: { _id: 0, imagePath: 1, description: 1, subscribed: 1 } }
    ).toArray(function(err, result) {
    if (err) throw err;
    // res.render(result[0]["description"]);
    console.log(result[0]["description"]);
    db.close();
  });
});