Closed Sathyababuramk closed 6 years ago
Can you provide a sample of the code?
Hi @e-oj ,
var newTask = fawn.Task();
var collection1 = new collection1();
newTask .initModel('collection1', collection1.schema.paths);
newTask .save('collection1', collection1);
newTask.initModel('collection2', collection2.schema.paths);
newTask.update('collection2',updateCondition,)
;
newTask.run().then(function(){ })
In this, I was saving the first collection1 and then updating the second collection with some update condition, and then pushing array elements.
For example, suppose I have 10 arrays to match condition and push on collection2. if it fails in the sixth condition, it saved the 1 to 5 array in collection2, stop pushing 6 to 10 array, it Doesn't throw any error or revert back.
Hard to say what the issue might be. Can you post the actual code? Also, you should only use initModel if you're using mongoose and the model hasn't been initialized yet.
I'll be closing this issue. Feel free to reopen if you encounter any problems.
I had a number of similar issues with the update, but in the end, the following worked: try { await new Fawn.Task() .update('collection', { _id: mongoose.Types.ObjectId(req.params.id) } , { name: 'test', desc: 'description }) .run({useMongoose: true}); } catch(err) { console.log(err); }
Hi, i have been using fawn version 2.1.5. Taking two collections one have to save the set of data into db and other collection to match some condition and add push new array in the collection.
For example i have to save 10 records to save and to update in another collection(pushing array into the collection). The problem that i facing was the 10 records saved successfully and only 8 data update in another collection and fawn doesn't throw any error.
Please help me to fix the issue...