dougu5886 2011-10-05 05:54
浏览 222
已采纳

Mongodb中ID的序列号

There is findAndModify command in Mongo DB to use auto increment numbers instead of the default ID, but I do not know how to use it for PHP driver (I am not sure if it is supported at all).

  • 写回答

2条回答 默认 最新

  • dongzinen1061 2011-10-08 07:20
    关注

    Ok, if you need to store incremental values i suggest you do it using some other field not the mongodb _id field mongodb used these generated id's to return some (i believe many if not all) types of queries, especially if you have a multi cluster set up then it definitely uses the _id field to locate the physical disk the data is on (i believe using a hash table or some such technology - not entirely up to date with the under the hood operations of mongo's kernel). In short, please leave this alone its designed to be an auto generated reference field.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 写uniapp时遇到的问题
  • ¥15 vs 2008 安装遇到问题
  • ¥15 matlab有限元法求解梁带有若干弹簧质量系统的固有频率
  • ¥15 找一个网络防御专家,外包的
  • ¥100 能不能让两张不同的图片md5值一样,(有尝)
  • ¥15 informer代码训练自己的数据集,改参数怎么改
  • ¥15 请看一下,学校实验要求,我需要具体代码
  • ¥50 pc微信3.6.0.18不能登陆 有偿解决问题
  • ¥20 MATLAB绘制两隐函数曲面的交线
  • ¥15 求TYPCE母转母转接头24PIN线路板图