Client Error: Next object larger than space left in message

I was scratching my head over this error message.  When Googling didn’t return many answers I figured it was something I was doing wrong.  So if you’re running node.js with Mongo and you see the message:

Error is: Client Error: Next object larger than space left in message

The problem is that I wasn’t creating a proper object.  I was simply trying to save a string, whereas instead it should have been an object that had a string field with a value.

Wrong way:

var token = "123";
mongo.save(token); //pseudo-code

Right way:

var item = {};
item.token = "123";
mongo.save(item);
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s