How to resolve this .then not resolvable? Promisify?

I would like to get collection count followed by switch case logic depending on the value count returned, but .then is not resolvable? So I need to Promisfy?

FutureTasks.findOne({userid: details.userid}).count
        .then(x=> {   <==== cannot resolve .then method?
            var result;

            switch (true) {
                case(x > 1): business logic
                result = ....

                case(x > 0): Some other business logic etc
                result = .....

otherwise I am doing

var result;

var x = FutureTasks.findOne({userid: details.userid}).count;

        switch (true) {

            case (x > 0): etc
            case(x > 1): etc

which I am not sure whether x will be ready by the time switch case needs to be evaluated?

var x = FutureTasks.findOne({userid: details.userid}).count;

This runs synchronously in Meteor code, so no need to promisfy (note lack of callback)

Hi reoh

I am calling one of the collection attribute which just so happened to be name as count (badly named):

var x = FutureTasks.findOne({userid: details.userid}).count;

not the internal count method

var x = FutureTasks.findOne({userid: details.userid}).count();

so in that case if it still synchronous or asynchronous. Also where to look up whether it is one or the other within the IDE?

It’s still synchronous.

Not sure which IDE you are talking about.

PyCharm or Webstorm etc

Hmm, no idea, sorry.