This page shows some examples of converting from ssb-db (and its various helper modules, ssb-backlinks, ssb-query, etc) to ssb-db2.
Includes also old messages.
pull(
sbot.backlinks.read({
query: [{ $filter: { dest: msgId } }],
index: 'DTA',
live: true
}),
pull.drain(msg => {
// ...
})
)
const {and, votesFor, live, toPullStream} = require('ssb-db2/operators')
pull(
sbot.db.query(
and(votesFor(msgId)),
live({ old: true }),
toPullStream()
),
pull.drain(msg => {
// ...
})
)
pull(
sbot.links({
source: aliceId,
dest: bobId,
rel: 'contact',
live: false,
reverse: true
}),
pull.take(1),
pull.drain(msg => {
// ...
})
)
const {and, author, contact, descending, paginate, toCallback} =
require('ssb-db2/operators')
sbot.db.query(
and(author(aliceId), contact(bobId)),
descending(),
paginate(1),
toCallback((err, response) => {
const msg = response.results[0]
// ...
})
)