Mongoose 中的 Mongo BSON 类型

Posted

技术标签:

??????Mongoose ?? Mongo BSON ????????:Mongo BSON Types in Mongoose ??????:2016-07-08 18:45:56 ??????:

???? mongoose ?? Timestamp() ? mongodb docs ?????? mongo shell ???

?????this ?????,????????:

oplogModel.find(ts: $gte: lastTimestamp, $lt: Timestamp(currTimestam
                                                    ^
ReferenceError: Timestamp is not defined

??????:

***.com/questions/10006218/… ????? ??????????????????????? ?????1?:

?Timestamp ?????????????????

??????mongoose.mongo??????????:

var mongoose = require('mongoose'),
    Timestamp = mongoose.mongo.Timestamp;

?????????????????? BSON ????????

???,shell ??“????”????????????????(?? BSON ??????)???????????????

????,???????,?????Date?????? BSON Date ??,???????????????????????????????? Date ??,??????????????

Timestamp ?????,????????????????????

????:

var Timestamp = mongoose.mongo.TimeStamp; oplogModel.find(ts: $gte: lastTimestamp, $lt: Timestamp(currTimestam ^ TypeError: undefined is not a function ??????? @Shipra ??mongoose.mongo.Timestamp?????????????????? ????? Date ??? epoch ???????? oplog ?? BOSON ????????? @Shipra ??????????????????? BSON ????,?????????????,??? mongoose ?,????????????????,??????????????????,????????????????????,??Ask Another Question @Shipra ?,??????????????????????,??Ask another Question??????????????????????????,????????????????????????????????????????????,?????????????????,??????????

以上是关于Mongoose 中的 Mongo BSON 类型的主要内容,如果未能解决你的问题,请参考以下文章

Mongo基础使用,以及在Express项目中使用Mongoose

go操作mongo

golang mongo-driver filter 构建--bson和golang基础类型

MongoError:在对嵌套文档中的记录进行分组时,无法从缺少的 BSON 类型转换为日期

org.bson.json.JsonParseException:JSON 阅读器期待一个值,但发现 ':' - Springboot 中的 Mongo 查询抛出此错误

Apache Zeppelin 中的 org/bson/conversions/Bson 错误