Mongodb find created results by date today

Your start date object should hold the current date time hours at 00:00:00.000 (milliseconds precision) and set the hours for today’s date to 23:59:59.999: var start = new Date(); start.setHours(0,0,0,0); var end = new Date(); end.setHours(23,59,59,999); Then pass the modified date objects as usual in your MongoDB query operator: db.posts.find({created_on: {$gte: start, $lt: end}}); If … Read more

How to read csv file in node js

Use a library, CSV has lots of gotchas. I have come to enjoy the package csv. It is located here: https://www.npmjs.com/package/csv . Here is a very quick example using the async api. const fs = require(‘fs’) var parse = require(‘csv-parse’) fs.readFile(inputPath, function (err, fileData) { parse(fileData, {columns: false, trim: true}, function(err, rows) { // Your … Read more

Request header field Access-Control-Allow-Headers is not allowed by itself in preflight response

When you start playing around with custom request headers you will get a CORS preflight. This is a request that uses the HTTP OPTIONS verb and includes several headers, one of which being Access-Control-Request-Headers listing the headers the client wants to include in the request. You need to reply to that CORS preflight with the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)