Hey is there a way to add to each document retrieved from mongo a counter?
So lets say we have users : {_id, name} in mongo . I want to fetch them all and to each retrieved document I want to add a counter field and increase it as I fetch the docs.
so the result would be
users : [{_id: "some_id_1", name: "john", counter: 1}, {_id: "some_id_2", name: "bob", counter: 2]
so this counter field would be generated on the fly ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…