Fabian Vogelsteller
Fabian Vogelsteller

Reputation: 1065

Insert am document at index in Meteor Collection

i need to replace an elements in an Meteor.Collection, but want to replace it, so it appears in the same position as the old one.

For that i found in the docs in observe, that there is an atIndex parameter in the callbacks.

e.g.

cursor.observe({
   addedAt: function(document, atIndex, before){
      ...
   }
   ...
})

does this mean i can insert objects at a specific index position, if so how?

Upvotes: 0

Views: 142

Answers (1)

Kristoffer K
Kristoffer K

Reputation: 2053

If you use .update() it will appear in the same position.

Or maybe I misunderstand what you're trying to accomplish?

Upvotes: 1

Related Questions