I have a collection with following entry
{
"_id" : "6z2pQDYozQxEyPZYv",
"userId" : "b2dQ6SuPrwmPsLsg8",
"communicatingWith" : [ "KMT74bWPoZxDSKdrx", "KMT74bWPoZxDSKdrx" ]
}
when I query mongo through meteor for the field communicatingWith , if I do a console.log(communicatingWith)
, the output is
[ 'KMT74bWPoZxDSKdrx', 'KMT74bWPoZxDSKdrx' ]
.
Even when I do console.log(communicatingWith.length)
the output is 2
But when I do
communicatingWith.each(function(item){console.log(item)})
it throws error saying
Exception while invoking method 'createPrivateMsgHanger' TypeError: Object KMT74bWPoZxDSKdrx,KMT74bWPoZxDSKdrx has no method 'each'
Can you please help me understand where things are wrong?