Answers for "how to delete first n documents in mongodb"

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 "how to delete first n documents in mongodb"

Browse Popular Code Answers by Language