第二次报这个错了, 一直以为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. 标准对象——RegExp

    字符串是编程时涉及到的最多的一种数据结构,对字符串进行操作的需求无处不在.比如判断一个字符串是否是合法的Email地址,虽然可以编程提取@前后的子串,再分别判断是否是单词和域名,但这样麻烦且代码难以复 ...

  2. 面试遇到的select into 但是在PL/SQL developer ORA-00905:缺失关键字"错误。

    select into 是什么意思. 1.INSERT INTO SELECT语句 语句形式为:Insert into Table2(field1,field2,...) select value1, ...

  3. css3 RGBA 红色R+绿色G+蓝色B+Alpha通道

    语法: R:红色值.正整数 | 百分数 G:绿色值.正整数 | 百分数 B:蓝色值.正整数| 百分数 A:透明度.取值0~1之间 取值: <length>:Hue(色调).0(或360)表 ...

  4. Centos防火墙的配置

    Selinux的三种模式:enforcing,passive,disable 临时更改模式:setengorce 1|0        1:enforcing,   0:passive [root@C ...

  5. filter-policy和AS-PATH-FILTER过滤BGP路由条目

    Filter-policy过滤BGP路由条目 一:根据项目需求搭建好拓扑图如下: 二:配置 1:对项目图做理论分析,首先RT1和RT2属于EBGP(不同自治系统之间的直连路由),而RT2和RT3属于I ...

  6. JS高级. 06 缓存、分析解决递归斐波那契数列、jQuery缓存、沙箱、函数的四种调用方式、call和apply修改函数调用方法

    缓存 cache 作用就是将一些常用的数据存储起来 提升性能 cdn //-----------------分析解决递归斐波那契数列<script> //定义一个缓存数组,存储已经计算出来 ...

  7. 在python中安装basemap

    在python中安装basemap 1. 确保python环境安装完毕且已配置好环境变量 2. 安装geos: pip install geos 3. 下载.whl文件: (1)pyproj‑1.9. ...

  8. 让CPU使用率正弦变化

    网络上流传一个面试题,说如何编程让CPU的使用率按照正弦方式变化 代码如下(运行环境Linux): #include <stdio.h> #include <stdlib.h> ...

  9. 洛谷P4016 负载平衡问题

    题目描述 G 公司有 n 个沿铁路运输线环形排列的仓库,每个仓库存储的货物数量不等.如何用最少搬运量可以使 n 个仓库的库存数量相同.搬运货物时,只能在相邻的仓库之间搬运. 输入输出格式 输入格式: ...

  10. 7.Mongodb复制(副本集)

    1.复制 什么是复制 复制提供了数据的冗余备份,并在多个服务器上存储数据副本,提高了数据的可用性,并可以保证数据的安全性 复制还允许从硬件故障和服务中断中恢复数据 为什么要复制 数据备份 数据灾难恢复 ...