J
J
judywb2022-02-16 16:49:14
MongoDB
judywb, 2022-02-16 16:49:14

How to remove the first element of an array in a mongodb (nodejs) entry?

I have a field, how do I remove the first element of item_keys?
620d00a40390f648561352.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rag'n' Code Man, 2022-02-16
@judywb

Browser prompt: "MongoDB remove first element from an array".
Result: https://docs.mongodb.com/manual/reference/operator...

db.collection.updateOne({ _id: ... }, { $pop: { item_keys:  -1 } })

Have you seriously waited 20 minutes for this?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question