Unexpected behavior when index creates without callback

11 views
Skip to first unread message

r.u.go...@gmail.com

unread,
Dec 23, 2017, 3:26:04 AM12/23/17
to node-mongodb-native
Hi.
I wanted to create unique index and used the callback approach first:
  code - https://gyazo.com/8d3e2da0901827e097a0da1e10069489

It works fine, and unique index created:
  mlab - https://gyazo.com/ea1e71ecd51f87a31329cb3e59be7c30

But, if I use promise instead:
  code - https://gyazo.com/f23b5c147e6a50b2e6fffb0c16f6014d

There are no errors, but created index doesn't have uniqueness:
  console - https://gyazo.com/7b6484cf1e44248fedb096b3f762f1e3
  mlab - https://gyazo.com/a6db7b0173e57f74f00e7f3fa96e6785

If I use .then instead async/await - the same result.
Is it bug or I just didn't get some part of docs?

r.u.go...@gmail.com

unread,
Dec 23, 2017, 4:35:42 PM12/23/17
to node-mongodb-native

So, I wrote my own promise and it works as expected:
code - https://gyazo.com/f83282644299320607904874c89827c1
Reply all
Reply to author
Forward
0 new messages