When I try to run my code it shows "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);
});
Calling Tailable on an empty capped collection will cause this error, make sure the collection is not empty (Tested it and it works)