Skip to content

Tag: node.js

rest / spread in java script

guys can someone explain what ([head, …[headTail, …tailTail]]) in the input of this link solution is doing? I can’t comment and ask the writer due to low reputation! he is writing a function that takes an array of arrays in input (based on where he calls it) but although I know few things ab…

Setting Socket.io room variables

I would like to store some information in the socket room variables, but am getting the following error: UnhandledPromiseRejectionWarning: TypeError: Cannot set property ‘host’ of undefined This is my code: If I try to log socket.roomId it would return something like rBAhx0. And when I log io.sock…

How to exclude fields on return in mongoose

I have the following code: It works perfectly but say I want to exclude a field returned, like the __v field. I know I can do this by just creating an object like and etc. for teh other fields, however if I have 20 fields I don’t want to list every single one, so is there a way for mongoose