Hello,
I am trying to insert into my mongo collection when I recieve messages from Legacy Server. I got errors like:
Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.
So I tried bounding with below code but, it still gives me the same error.
const bound = Meteor.bindEnvironment((callback) => {callback();});
bound(() => {
if (err) {
console.log(err); // an error occurred
} else {
let game = {
date: new Date(),
// status: them.settings.autoaccept ? “playing” : “pending”,
status: “pending”,
requestBy:self.user._id,
legacy_id: p2[0],
clocks: {
white: { time: p2[6], inc: p2[5] },
black: { time: p2[8], inc: p2[7] }
},
white: {
name: p2[1],
rating: p2[12]
},
black: {
name: p2[2],
rating: p2[13]
},
moves: ,
actions:
}
console.log(game);
GameCollection.insert(game);
}
});
Please guide.