Untitled

mail@pastecode.io avatar
unknown
javascript
a year ago
707 B
1
Indexable
Never
// Requires official Node.js MongoDB Driver 3.0.0+
var mongodb = require("mongodb");
var BSONRegExp = mongodb.BSONRegExp;

var client = mongodb.MongoClient;
var url = "mongodb://host:port/";

client.connect(url, function (err, client) {
    
    var db = client.db("actinver");
    var collection = db.collection("customers");
    
    var query = {
        "openingDate": new BSONRegExp(".*-11-.*", "i")
    };
    
    var cursor = collection.find(query);
    
    cursor.forEach(
        function(doc) {
            console.log(doc);
        }, 
        function(err) {
            client.close();
        }
    );
    
    // Created with Studio 3T, the IDE for MongoDB - https://studio3t.com/
    
});