DEV Community

Cover image for mongoDb change position of Array element
parmeshwar rathod
parmeshwar rathod

Posted on

2 1

mongoDb change position of Array element

This post is to understand mongoDB query
Let's se how s$position operator works!! 🤩🥳

$position

it's operator used in mongoDB woth $(dollerSign) as pre-
basically its specifies position(index) in an Array
at which $push operator inserts elements/objects.

Example

mongo theme

let's see how to add element at any
position in above document using
$positoon operator

Queryof$position

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.

Cloudinary image

Zoom pan, gen fill, restore, overlay, upscale, crop, resize...

Chain advanced transformations through a set of image and video APIs while optimizing assets by 90%.

Explore

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay