Mathias Colpaert
Mathias Colpaert

Reputation: 21

STH Comet - raw insert in mongo database

I want to insert a set of historical data in the MongoDB, and expose it with STH Comet API. I can insert it in the mongoDb, with the correct recvTime. It is unclear if this is allowed.

Can I insert data in the raw mongo collection? How will this affect the aggregate collection?

Upvotes: 2

Views: 101

Answers (1)

fgalan
fgalan

Reputation: 12294

STH is not thought to insert document directly in MongoDB. This is typically done by STH itself or by the NGSIMongoSink (raw) and NGSISTHSink (aggregates) of Cygnus. In production scenarios, Cygnus-based insertion is preferred (we have found that STH insertion may be problematic in high load scenarios, as it may penalize the STH query API).

However, nothing precludes you to insert directly documents in the STH DB if you know the document structure used by STH (the aforementioned links and the documentation of STH itself are good starting points). However, no processing is done in this case, so if you insert documents in the raw samples collection that will not automatically generate the correspondent documents in the aggregates collection.

However, it would be possible in theory to develop a batch process (a script reading and writing in the DB) to generate the aggregates based in the raw collection content. If you do it, please tell us, as it would be a very good contribution to the STH repository :)

Upvotes: 2

Related Questions