Sets
db.sets.get returns read-only snapshots for beatmap sets. You can keep chaining filters or use normal array methods.
These examples use a small fixture that resets for every run. Your application still uses its own Realm database.
all
Returns all matching beatmap sets in a regular array.
return db.sets.get
.all()
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))toArray
Returns all matching beatmap sets in a regular array.
return db.sets.get
.toArray()
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))first
Returns the first matching beatmap set, or undefined.
return db.sets.get
.first()?.OnlineIDcount
Counts all matching beatmap sets, even when a limit is set.
return db.sets.get
.count()limit
Limits how many beatmap sets elements are accessed.
return db.sets.get
.limit(1)
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))sortedBy
Sorts beatmap sets by a database field.
return db.sets.get
.sortedBy('DateAdded')
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))autoEdit
Starts an edit session that buffers changes to matching beatmap sets. Commit or roll them back when you are done.
const session = db.sets.get
.limit(1)
.autoEdit()
const length = session.length
session.rollback()
return lengthcommit
Saves the pending changes.
const session = db.sets.get
.limit(1)
.autoEdit()
const length = session.length
session.commit()
return lengthrollback
Discards the pending changes.
const session = db.sets.get
.limit(1)
.autoEdit()
const length = session.length
session.rollback()
return lengthwrite.delete
Deletes every matching beatmap set in one transaction.
return db.sets.get
.limit(1)
.write.delete()write.update
Applies a typed patch to every matching beatmap set.
return db.sets.get
.limit(1)
.write.update({ Status: 1 })byBeatmapMd5
Finds beatmap sets where beatmap MD5 matches the supplied value. You can chain more filters on the result.
return db.sets.get
.byBeatmapMd5('b'.repeat(32))
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))byBeatmapOnlineId
Finds beatmap sets where beatmap online ID matches the supplied value. You can chain more filters on the result.
return db.sets.get
.byBeatmapOnlineId(506483)
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))byDateAddedAfter
Finds beatmap sets where date added is after the supplied date. You can chain more filters on the result.
return db.sets.get
.byDateAddedAfter(new Date('2024-01-01'))
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))byDateAddedBefore
Finds beatmap sets where date added is before the supplied date. You can chain more filters on the result.
return db.sets.get
.byDateAddedBefore(new Date('2024-01-01'))
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))byDateRankedAfter
Finds beatmap sets where date ranked is after the supplied date. You can chain more filters on the result.
return db.sets.get
.byDateRankedAfter(new Date('2024-01-01'))
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))byDateRankedBefore
Finds beatmap sets where date ranked is before the supplied date. You can chain more filters on the result.
return db.sets.get
.byDateRankedBefore(new Date('2024-01-01'))
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))byDateSubmittedAfter
Finds beatmap sets where date submitted is after the supplied date. You can chain more filters on the result.
return db.sets.get
.byDateSubmittedAfter(new Date('2024-01-01'))
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))byDateSubmittedBefore
Finds beatmap sets where date submitted is before the supplied date. You can chain more filters on the result.
return db.sets.get
.byDateSubmittedBefore(new Date('2024-01-01'))
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))byDeletePending
Finds beatmap sets where delete pending matches the supplied value. You can chain more filters on the result.
return db.sets.get
.byDeletePending(true)
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))byHash
Finds beatmap sets where hash matches the supplied value. You can chain more filters on the result.
return db.sets.get
.byHash('a'.repeat(64))
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))byId
Finds beatmap sets where ID matches the supplied value. You can chain more filters on the result.
return db.sets.get
.byId('22222222-2222-4222-8222-222222222222')
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))byOnlineId
Finds beatmap sets where online ID matches the supplied value. You can chain more filters on the result.
return db.sets.get
.byOnlineId(506483)
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))byProtected
Finds beatmap sets where protected matches the supplied value. You can chain more filters on the result.
return db.sets.get
.byProtected(true)
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))byStatus
Finds beatmap sets where status matches the supplied value. You can chain more filters on the result.
return db.sets.get
.byStatus(1)
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))withFile
Finds beatmap sets related to the supplied file.
return db.sets.get
.withFile('audio.mp3')
.map(item => ({
onlineId: item.OnlineID,
files: item.Files.length,
}))