I have a node.js script in which I'm trying to do something as simple as execute a Mongoose query and then read the response in the promise .then
The problem is no matter what I try, the .then
never seems to happen. What am I doing wrong?
Here is my node file code:
const WorkOrder = require('../models/WorkOrder');
let promise = WorkOrder.findOne({}).exec();
promise.then(result => {
console.log('result', result);
);
When I do a console.log(WorkOrder.findOne({}).exec())
I get:
Promise {
emitter:
EventEmitter {
domain: null,
_events: {},
_eventsCount: 0,
_maxListeners: undefined },
emitted: {},
ended: false }
This a similar function is used in another part of the app (which uses redux) that has way more going on, this is just a super boiled down version just to see if I can query my database and then look at the result.
What is going on here?
via Stevie Star