KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
In the following example, assume the document is in the db.people collection. How to remove the 3rd element of the interests array by it's index ? { "_id" : ObjectId("4d1cb5de451600000000497a"), "name" : "dannie", "interests" : [ "guitar", "programming", "gadgets", "reading" ] } This is my current solution: var interests = db.people.findOne({"name":"dannie"}).interests; interests.splice(2,1) db.people.update({"name":"dannie"}, {"$set" : {"interests" : interests}}); Is there a more direct way?
Tags (comma-separated)
Save Edits
Cancel