Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases Mongo Basics Go Further With Mongo Updating Data

Nate Baker
Nate Baker
17,247 Points

When trying to run db.posts.update, receive error.

When I try to run db.posts.update as shown in video, I receive following error message:

"errmsg": ">1 field in obj: { tags: [ \"foo\", \"bar\", \"interesting\" ], title: \"I'm an Updated Title!\" }"

Here's my statement:

db.posts.find({author: ObjectId("5a3201ab48e2b371eafe230f")}, {$set: {tags: ['foo', 'bar', 'interesting'], title: "I'm an Updated Title!"}})

Dave StSomeWhere
Dave StSomeWhere
19,870 Points

That looks like a .find statement. What does your .update statement look like?

Nate Baker
Nate Baker
17,247 Points

Aaaaand...that was the issue. I notice the longer I go at this, the more tired I get and miss stupid stuff like that.

Thanks, Dave.