zebra-lucky / meteor-aggregate-retyped

Meteor Mongo.Collection aggRetyped aggregate method
MIT License
1 stars 1 forks source link

Get error for using `replaceTypes, replaceMeteorAtomWithMongo` #2

Closed thearabbit closed 5 years ago

thearabbit commented 5 years ago

I tried copy this repo to use in Local (Bc can not install 0.0.2).

Get error for using replaceTypes, replaceMeteorAtomWithMongo

{ normalVal: 0.1,
I20190527-10:31:51.257(7)?   decimalVal:
I20190527-10:31:51.257(7)?    Decimal128 {
I20190527-10:31:51.257(7)?      _bsontype: 'Decimal128',
I20190527-10:31:51.258(7)?      bytes: <Buffer 01 00 00 00 00 00 00 00 00 00 00 00 00 00 3e 30> } }
W20190527-10:31:51.333(7)? (STDERR) (node:2893) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
W20190527-10:31:51.334(7)? (STDERR)     at Array.forEach (<anonymous>)
W20190527-10:31:51.334(7)? (STDERR)     at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)
W20190527-10:31:51.334(7)? (STDERR)     at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)
W20190527-10:31:51.334(7)? (STDERR)     at Array.forEach (<anonymous>)
W20190527-10:31:51.335(7)? (STDERR)     at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)
W20190527-10:31:51.335(7)? (STDERR)     at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)
W20190527-10:31:51.335(7)? (STDERR)     at Array.forEach (<anonymous>)
W20190527-10:31:51.335(7)? (STDERR)     at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)
W20190527-10:31:51.335(7)? (STDERR)     at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)
W20190527-10:31:51.336(7)? (STDERR)     at Array.forEach (<anonymous>)
W20190527-10:31:51.336(7)? (STDERR)     at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)
W20190527-10:31:51.336(7)? (STDERR)     at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)
W20190527-10:31:51.336(7)? (STDERR)     at Array.forEach (<anonymous>)
W20190527-10:31:51.336(7)? (STDERR)     at Object.EJSON.clone.v [as clone] (packages/ejson/ejson.js:594:18)
W20190527-10:31:51.337(7)? (STDERR)     at Object.keys.forEach.key (packages/ejson/ejson.js:595:22)
W20190527-10:31:51.337(7)? (STDERR)     at Array.forEach (<anonymous>)
W20190527-10:31:51.337(7)? (STDERR) (node:2893) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
W20190527-10:31:51.337(7)? (STDERR) (node:2893) [DEP0018] DeprecationWarning: Unhandled promise

Insert in Raw Collection


....
async run(){
        let data = {
          normalVal: 0.1,
          // decimalVal: MongoDB.Decimal128.fromString('0.1'),
          decimalVal: Decimal('0.1'),
        } //
        data = replaceTypes(data, replaceMeteorAtomWithMongo)
        console.log(data)

       return await NumberVal.rawCollection().insertOne(data)
}
thearabbit commented 5 years ago

Work fin with no async/await. But I would like to use Async/Await for method that use Raw Collection

thearabbit commented 5 years ago

Now work fine