-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Closed
Labels
underlying library issueThis issue is a bug with an underlying library, like the MongoDB driver or mongodb-coreThis issue is a bug with an underlying library, like the MongoDB driver or mongodb-core
Milestone
Description
#!/usr/bin/env node --no-deprecation
'use strict';
const moment = require('moment');
const mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/test');
const conn = mongoose.connection;
const Schema = mongoose.Schema;
const schema = new Schema({
name: String,
createdAt: Date
});
const Test = mongoose.model('test', schema);
const tests = [];
for (let i = 1; i <= 100; i++) {
let date = moment().subtract(i, 'days');
tests.push(new Test({ name: `name${i}`, createdAt: date }));
}
async function run() {
await conn.dropDatabase();
await Test.create(tests);
const start = moment().subtract(50, 'days').startOf('day');
const cutoff = moment().endOf('day');
try{
const result = await Test.countDocuments({
$invalid: start
})
}catch(e){
console.log('caught error')
console.error(e)
}
console.log(result);
return conn.close();
}
run();
TypeError: callback is not a function
Metadata
Metadata
Assignees
Labels
underlying library issueThis issue is a bug with an underlying library, like the MongoDB driver or mongodb-coreThis issue is a bug with an underlying library, like the MongoDB driver or mongodb-core