These are chat archives for Automattic/mongoose

19th
Apr 2016
Ajay Ramesh
@Carpetfizz
Apr 19 2016 00:27
Is there any update on #3109 ? I've been trying to create a tailable cursor but I get the No more documents in tailed cursor error when trying to tail an empty collection. It seems to be ignoring numberOfRetries
Christoph Werner
@codepunkt
Apr 19 2016 08:39
hey everyone
when a save errors while working with async/await, such as
try {
  const session = new Session({ userId })
  await session.save()
} catch (e) {
}
will the error be catched or do i have to do something along these lines to catch it
const error = await session.save()
if (error) throw new Error(error)
LeonineKing1199
@LeonineKing1199
Apr 19 2016 15:06
@gonsfx The error should be catched
DickTracie
@DickTracie
Apr 19 2016 15:12
Caught*
LeonineKing1199
@LeonineKing1199
Apr 19 2016 15:24
Thank you, Dick Tracie
Valeri Karpov
@vkarpov15
Apr 19 2016 16:28
@Carpetfizz not yet. How are you setting numberOfRetries? Open up an issue on github for that please, easy to lose track of stuff in gitter
Ajay Ramesh
@Carpetfizz
Apr 19 2016 16:47
@vkarpov15 sure I'll create an issue. I just wanted to make sure I wasn't doing something obviously wrong. I was told that only awaitData option was needed, but it still doesn't work:
var stream = Photo.find().tailable(true, { awaitData: true }).stream();
LeonineKing1199
@LeonineKing1199
Apr 19 2016 16:58
I actually had no idea Mongo could stream data. That is so freaking cool!
Ajay Ramesh
@Carpetfizz
Apr 19 2016 16:58
@LeonineKing1199 it's super useful for what I'm trying to do! If only I can get it to work
LeonineKing1199
@LeonineKing1199
Apr 19 2016 16:59
Wish I could help you lol
Ajay Ramesh
@Carpetfizz
Apr 19 2016 16:59
no worries lol
Pier-Luc Gagnon
@Nepoxx
Apr 19 2016 17:09
How does that work though?
I mean, what is there to stream, it's not like you can process a partial document
Ajay Ramesh
@Carpetfizz
Apr 19 2016 17:12
It's a tailable collection where each insert is emitted
LeonineKing1199
@LeonineKing1199
Apr 19 2016 17:16
Yes, but is it web scale?
Ajay Ramesh
@Carpetfizz
Apr 19 2016 17:16
@vkarpov15 is this still a valid workaround? Saw one of your replies to an issue:
function startWatching() {
    var processedPhotoStream = ProcessedPhoto.find().tailable(true, 
    {awaitData: true, numberOfRetries: Number.MAX_VALUE}).stream();

    processedPhotoStream.on('data', function(photo){
        console.log(photo.name);
    }).on('error', function(error){
        processedPhotoStream.destroy();
        startWatching();
    }).on('close', function(){
    });
}
startWatching();
@LeonineKing1199 i dont know is it?
LeonineKing1199
@LeonineKing1199
Apr 19 2016 17:18
Thank you for not actually getting trolled by me XD
Ajay Ramesh
@Carpetfizz
Apr 19 2016 17:18
:D
Pier-Luc Gagnon
@Nepoxx
Apr 19 2016 17:28
That's all you do here :P
us͡an̸df͘rien͜ds͠
@usandfriends
Apr 19 2016 19:22
@Carpetfizz Hi
Pier-Luc Gagnon
@Nepoxx
Apr 19 2016 19:29
someone discovered the joys of unicode
LeonineKing1199
@LeonineKing1199
Apr 19 2016 19:31

Ho snap, @usandfriends , you also post in the cplusplus gitter :)

I love Node.js too

Ajay Ramesh
@Carpetfizz
Apr 19 2016 19:34
I've heard of @usandfriends I think he made a chess game?
LeonineKing1199
@LeonineKing1199
Apr 19 2016 19:40
Must be chess plus plus. I see that in my recommended gitters
us͡an̸df͘rien͜ds͠
@usandfriends
Apr 19 2016 19:51
@LeonineKing1199 No one talks in there anymore :P
@Nepoxx Zalgo for life :D
@Carpetfizz lol pls