Answers for "mongodb array delete first n documents"

1

mongodb remove first element from array

// Exampmle of document
{ _id: 1, scores: [ 8, 9, 10 ] }

// The following example removes the first element (8) in the scores array:
db.students.update( { _id: 1 }, { $pop: { scores: -1 } } )
Posted by: Guest on August-04-2021

Code answers related to "mongodb array delete first n documents"

Browse Popular Code Answers by Language