【发布时间】:2014-04-15 05:36:09
【问题描述】:
我试过这个:
posts = Posts.find({},
sort:
position: 1
).fetch()
for post in posts
i = 1
Posts.update post._id,
$set:
position: i
i++
但所有帖子都以位置 1 结束。我想要的是 1、2、3、4 等。
我做错了什么?
【问题讨论】:
-
您的
i = 1在循环中...每次迭代都将其设置为 1。
标签: coffeescript