dongzhuoxie1244 2013-04-14 19:46
浏览 972

MongoDB将ObjectId转换为结果中的字符串

If document has fields with value as MongoId object, it will be returned to php something like http://dl.dropbox.com/u/7017985/Screenshots/26.jpg, is there any way how to return it like simple strings and not as MongoId object.

Why I need it ? Because I need to send result to javascript browser side. I have document which has 2-3 fields which is refs to another document, and they keep as ObjectId.

  • 写回答

4条回答

  • douweng7233 2013-04-14 20:02
    关注

    MongoID supports __toString. If you cast it as a string, or call __toString directly, it will convert the value to a string.

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料