Mongo Tailable Cursor { Error: No More Documents in Tailed Cursor }

Mongo Tailable Cursor { Error: No More Documents in Tailed Cursor }

当我尝试 运行 我的代码时,它显示 "MongoError: No More Documents in Tailed Cursor"。

const mongoose = require('mongoose');
const Schema = require('mongoose').Schema;
const dataSchema = new Schema({
    id: String,
    name: Number,
    timestamp: Number
}, { capped: 5000000 });
const CappedData = mongoose.model('cappedData', dataSchema);
const dataCursor = CappedData.find({}).tailable(true, {awaitData: true}).cursor();
dataCursor.on('data', doc => {
    console.log(data);
});

在空的上限集合上调用 Tailable 会导致此错误,请确保集合不为空(已测试并有效)