Updating a MongoDB document by hand
If you want to update a single document by hand there is a gotcha. When you run a find
it looks like you are getting one result but you are actually getting a set of records which contains 1 entry.
Log into mongo:
> var x = db.person.find({"fake_dir":"/mrn/dir/thing"});
> var y = x.next();
> print(y);
[object BSON]
> y.XXXX = "blar blar";
blar blar
> y. // double tab to print the commands available
y.XXXX y.constructor y.name y.toLocaleString(
y._id y.created_at y.names y.toString(
y.bsonsize( y.fake_dir y.owner_id y.updated_at
y.clone_id y.hasOwnProperty( y.propertyIsEnumerable( y.valueOf(
> db.person.save(y);
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
No feedback yet
Form is loading...