Nodejs and Mongoose. Mode.find returns strange objectg

I a using socket.io for a web app. I want to return a object to the user but for some reason it returns this strange object, or like its the find function.

Object {options: Object, _conditions: Object, _updateArg: Object, op: "find"}

In my app.js file looking for the group:

  socket.emit "getgroup", $(".user").attr("data-name")

Then in server.js in node

  socket.on('getgroup', function (userid) {
    return io.sockets.emit('group', GroupModel.find({user:userid}));
  });

Where in this case it works like expected, returning all the tasks:

  socket.on('getall', function (socket) {
    return io.sockets.emit('getall', TaskModel.find());
  });

Why Am I not getting back the group model object?

You're sending the return value of MODEL.find(), which is a Query object. Because Mongoose queries are asynchronous, they don't return the actual query result but an object from which you can retrieve the result.

In your case, you'd want to wait for the query to return before sending a message back:

socket.on('getgroup', function (userid) {
  GroupModel.find({user:userid}, function(err, results) {
    if (err)
      // handle error
    else
      io.sockets.emit('group', results);
  });
});

I don't know why you other query (with TaskModel) works, because by the looks of it, it shouldn't (for the same reason: it returns a Query object; if you want the results from that object, you need to call .exec on it first or, as in the example above, pass it a callback function).