第二次报这个错了, 一直以为MongoDB的模型用的type 是 String, 一直报错, 找不到原因.

// 留言模型1
exports.Comment = mongolass.model('Comment',{
author: {type: Mongolass.Types.ObjectId, require:true},
content: { type: 'String', required: true },
postId: {type: Mongolass.Types.ObjectId, require: true}
})
exports.Comment.index({ postId: 1, _id:1 }).exec(); // 通过文章ID获取该文章下所有留言,按留言创建时间升序 exports.Comment = mongolass.model('Comment', {
author: { type: Mongolass.Types.ObjectId, required: true },
content: { type: 'string', required: true },
postId: { type: Mongolass.Types.ObjectId, required: true }
})
exports.Comment.index({ postId: 1, _id: 1 }).exec()

  

由于把string 写成了大写的String导致找不到错误的原因

mongolass 中报 ($.content: "say Hi ~") ✖ (type: String)的更多相关文章

  1. (转载)android:android.content.res.Resources$NotFoundException: String resource ID #..

    android.content.res.Resources$NotFoundException: String resource ID #0x0 找不到资源文件ID #0x0 原因分析如下: 遇到这种 ...

  2. The type String cannot be constructed. You must configure the container to supply this value.

    利用 Enterprise Library 5.0 Microsoft.Practices.EnterpriseLibrary.Common Microsoft.Practices.Enterpris ...

  3. Multiple annotations found at this line: - The content of element type "mapper" must match "EMPTY". - Attribute "namespace" must be declared for element type "mapper".

    今天在mybatis的mapper映射配置文件中遇到了这样的问题,困扰了我3个小时: Multiple annotations found at this line: - The content of ...

  4. The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?,objectWrapperFactory?,reflectorFactory?,plugins?,environments?,databaseIdProv

    在mybatis配置文件config.xml中报错: The content of element type "configuration" must match "(p ...

  5. The content of element type "package" must match "(result-types?,interceptors?...

    错误:“The content of element type "package" must match "(result-types?,interceptors?,de ...

  6. The content of element type "configuration" must match "(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?...

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE configuration PUBLIC & ...

  7. web.xml配置bug之提示The content of element type "web-app" must match "(icon?,display- name?,description?,distributable?,

    错误:配置web.xml时,出现红色叉叉,提示 The content of element type "web-app" must match "(icon?,disp ...

  8. swift2.0 Cannot assign a value of type '[CFString]' to a value of type '[String]'

    Cannot assign a value of type '[CFString]' to a value of type '[String]' 代码示例如下: picker.mediaTypes = ...

  9. android.content.res.Resources$NotFoundException:String resource ID #ffffffff

    无语,搞了半天,只能去插这个错误代号,结果就找到了这个结果. scoreTextView.setText(score+""); 这个一定要自己手动转换..不科学啊..关键是在ecl ...

随机推荐

  1. Unicode转化为汉字

    + (NSString *)replaceUnicode:(NSString *)unicodeStr { NSString *tempStr1 = [unicodeStrstringByReplac ...

  2. 【转】opatch学习

    [转自:https://yq.aliyun.com/articles/28007,仅作学习用途] Opatch 是oracle公司开发的安装,卸载,检测patch冲突的工具,管理oracle所有已经安 ...

  3. Hibernate知识点小结(四)--JPA

    一.jpa的简介和入门 JPA:Java Persistence API,接口规范    Hinernate内部为JPA规范提供实现        开发步骤(EntityManager):       ...

  4. Luogu P2590 [ZJOI2008]树的统计

    最近在学树剖,看到了这题就做了 [ZJOI2008]树的统计 思路 从题面可以知道,这题是树剖题(要求的和模板没什么区别呀喂 就是在普通的树剖上加了一个最大值 所以可以知道就是树剖+特殊的线段树 线段 ...

  5. 重装系统后激活win10和office2016

    激活win10: 重装的版本和电脑刚买来是的系统一样的话直接联网,过一段时间就会自动激活.如果不一样可以下载Kms工具激活. 激活office2016: 在开始菜单里双击“我的Office”,登录账号 ...

  6. 使用Python操作Office——EXCEL

    首先介绍下office win32 com接口,这个是MS为自动化提供的操作接口,比如我们打开一个EXCEL文档,就可以在里面编辑VB脚本,实现我们自己的效果.对于这种一本万利的买卖,Python怎么 ...

  7. springboot 集成kaptcha验证码Demo

    验证码(CAPTCHA)是“Completely Automated Public Turing test to tell Computers and Humans Apart”(全自动区分计算机和人 ...

  8. thinkphp5数据库导入Excel表格

    $data=$order_info; //$data 你要下载谁 就去查谁 // $data= Db::name('order_info') // ->field('consignee,tel, ...

  9. PHP Laravel 5.4 环境搭建

    1.php运行环境搭建 在win10系统上进行搭建的,使用的是wamp环境  wampserver3_x86_apache2.4.17_mysql5.7.9_php5.6.15.exe,安装包中集成了 ...

  10. BZOJ3265: 志愿者招募加强版(线性规划)

    Time Limit: 20 Sec  Memory Limit: 512 MBSubmit: 809  Solved: 417[Submit][Status][Discuss] Descriptio ...