안녕하세요~ 강사님.
아래와 같이 코딩을 하였습니다.
db.collection(${hive}
).find({}).toArray().then((data) => {
res.write("event: test\n")
res.write("data:" + JSON.stringify(data[data.length - 1]) + "\n\n")
})
//const pipeline = [{$match:{}}]
const collection = db.collection(${hive}
)
const changeStream = collection.watch()
changeStream.on("change",(result)=>{
console.log(result)
그리고, 아래와 같은 error가 출력이 됩니다.
MongoServerError: The $changeStream stage is only supported on replica sets
아래 그림으로도 첨부하였습니다.
강의에서는 따로 replica sets 에 대해 언급이 없었던 거 같은데, mongodb 사이트에 또 관련
내용이 있었습니다. 이래저래 해봐도 잘 안되어서, 언급 안하시 이유가 혹시 mongodb atlas는 필요없어서인지 또는
사실 다른게 원인인가 궁금합니다. 아니면 제가 mongodb를 설치한 환경이 ubuntu인데,
mongodb atlas가 아니어서 그런지... 궁금합니다.
새해 건강한 하루 하루 되세요~

