Open hoan006 opened 10 years ago
Hi,
try this
var person = Person.findOne.sync(Person, {name: "John"}); // not work
@hoan006 I added ".syncp" and ".futurep" functions, they work with promises: https://github.com/airs0urce/node-sync/commit/c62f1a9023094adf6bc4f4134f9faa60e68bc94f
Not a brilliant because of copy/paste, but it works with functions that return Promise. I made this to be able to move to generators (co) or async/await in future.
I'm mainly using Mongoose for my project and I hope I can achieve something like this:
Sadly, 'findOne' function uses promise (https://github.com/LearnBoost/mongoose/blob/3.8.x/lib/query.js#L991) and it breaks the node-sync, while 'count' doesn't use. Is there a way to support promise?