node.js - Promisified MongoDB Node driver throwing stack_overflow error on document insert -


when promisifying mongodb driver module, can insert multiple documents collection successfully. however, i'm getting stack_overflow error hitting catch block.

my approach based on answer question: mongodb node driver 2.0.* bluebird 2.9.* promisification

i'm promisifying mongodb this:

var promise = require('bluebird'),     mongodb = promise.promisifyall(require('mongodb')); 

my code looks this:

mongodb.connectasync("mongodb://myconnection").then(function(db) {     return db.collection("collection").insertmanyasync([{a: 1}, {b: 2}]); }).then(function(result) {     console.log('info', result); }).catch(function(err) {     console.log('error', err); }); 

the error caught in catch block (after then(function(result{}) has been executed every time) has type "stack_overflow".

i tried using insert method (insertasync() in case), has same results.


Comments

Popular posts from this blog

java - Spring Data JPA: Why findOne(id) executing delete query internally? -

python - Mongodb How to add addtional information when aggregating? -

java - Incorrect order of records in M-M relationship in hibernate -