Re: Is array index position in MongoDB document guaranteed to be maintained for operations?

From: Rhys Campbell <rhys.james.campbell@xxxxxxxxx>
To: mongodb-user <mongodb-user@xxxxxxxxxxxxxxxx>
Date: Mon, 25 Apr 2016 00:24:11 -0700 (PDT)
Why ads?
From the manual...

"The $position modifier specifies the location in the array at which the 
$push 
<https://docs.mongodb.org/manual/reference/operator/update/push/#up._S_push> operator 
insert elements. Without the $position modifier, the $push 
<https://docs.mongodb.org/manual/reference/operator/update/push/#up._S_push> operator 
inserts elements to the end of the array. See $push modifiers 
<https://docs.mongodb.org/manual/reference/operator/update/push/#push-modifiers> for 
more information."

https://docs.mongodb.org/manual/reference/operator/update/position/#up._S_position

I would say that this means order will be preserved in insert order if you 
don;t use the $position modifier. There's always the option of using the 
$position modifier with an index if you wish to be explicit. 

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
--- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to mongodb-user@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/4c8c0243-417c-4c54-9e14-b7a34ea3d2b2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Why ads?