Beatmaps
db.beatmaps.get returns read-only snapshots for beatmaps. 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 beatmaps in a regular array.
return db.beatmaps.get
.all()
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))toArray
Returns all matching beatmaps in a regular array.
return db.beatmaps.get
.toArray()
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))first
Returns the first matching beatmap, or undefined.
return db.beatmaps.get
.first()?.Metadata?.Titlecount
Counts all matching beatmaps, even when a limit is set.
return db.beatmaps.get
.count()limit
Limits how many beatmaps elements are accessed.
return db.beatmaps.get
.limit(1)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))sortedBy
Sorts beatmaps by a database field.
return db.beatmaps.get
.sortedBy('BPM')
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))autoEdit
Starts an edit session that buffers changes to matching beatmaps. Commit or roll them back when you are done.
const session = db.beatmaps.get
.limit(1)
.autoEdit()
const length = session.length
session.rollback()
return lengthcommit
Saves the pending changes.
const session = db.beatmaps.get
.limit(1)
.autoEdit()
const length = session.length
session.commit()
return lengthrollback
Discards the pending changes.
const session = db.beatmaps.get
.limit(1)
.autoEdit()
const length = session.length
session.rollback()
return lengthwrite.delete
Deletes every matching beatmap in one transaction.
return db.beatmaps.get
.limit(1)
.write.delete()write.update
Applies a typed patch to every matching beatmap.
return db.beatmaps.get
.limit(1)
.write.update({ Hidden: true })byArtist
Finds beatmaps where artist matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byArtist('Icon For Hire')
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byArtistContains
Finds beatmaps where artist contains the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byArtistContains('Hire')
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byAuthorContains
Finds beatmaps where author contains the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byAuthorContains('wajinshu')
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byAuthorOnlineId
Finds beatmaps where author online ID matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byAuthorOnlineId(124493)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byBeatDivisor
Finds beatmaps where beat divisor matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byBeatDivisor(4)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byBpmAbove
Finds beatmaps where BPM is above the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byBpmAbove(180)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byBpmBelow
Finds beatmaps where BPM is below the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byBpmBelow(220)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byBpmBetween
Finds beatmaps where BPM is between the supplied bounds. You can chain more filters on the result.
return db.beatmaps.get
.byBpmBetween(180, 220)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byDifficultyName
Finds beatmaps where difficulty name matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byDifficultyName('Insane')
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byDifficultyNameContains
Finds beatmaps where difficulty name contains the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byDifficultyNameContains('Hard')
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byEndTimeObjectCountAbove
Finds beatmaps where end time object count is above the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byEndTimeObjectCountAbove(10)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byEndTimeObjectCountBelow
Finds beatmaps where end time object count is below the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byEndTimeObjectCountBelow(50)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byHash
Finds beatmaps where hash matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byHash('a'.repeat(64))
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byHidden
Finds beatmaps where hidden matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byHidden(true)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byId
Finds beatmaps where ID matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byId('00000000-0000-4000-8000-000000000000')
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byLastLocalUpdateAfter
Finds beatmaps where last local update is after the supplied date. You can chain more filters on the result.
return db.beatmaps.get
.byLastLocalUpdateAfter(new Date('2024-01-01'))
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byLastLocalUpdateBefore
Finds beatmaps where last local update is before the supplied date. You can chain more filters on the result.
return db.beatmaps.get
.byLastLocalUpdateBefore(new Date('2024-01-01'))
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byLastOnlineUpdateAfter
Finds beatmaps where last online update is after the supplied date. You can chain more filters on the result.
return db.beatmaps.get
.byLastOnlineUpdateAfter(new Date('2024-01-01'))
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byLastOnlineUpdateBefore
Finds beatmaps where last online update is before the supplied date. You can chain more filters on the result.
return db.beatmaps.get
.byLastOnlineUpdateBefore(new Date('2024-01-01'))
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byLastPlayedAfter
Finds beatmaps where last played is after the supplied date. You can chain more filters on the result.
return db.beatmaps.get
.byLastPlayedAfter(new Date('2024-01-01'))
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byLastPlayedBefore
Finds beatmaps where last played is before the supplied date. You can chain more filters on the result.
return db.beatmaps.get
.byLastPlayedBefore(new Date('2024-01-01'))
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byLengthAbove
Finds beatmaps where length is above the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byLengthAbove(120000)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byLengthBelow
Finds beatmaps where length is below the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byLengthBelow(240000)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byLengthBetween
Finds beatmaps where length is between the supplied bounds. You can chain more filters on the result.
return db.beatmaps.get
.byLengthBetween(120000, 240000)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byMd5
Finds beatmaps where MD5 matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byMd5('b'.repeat(32))
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byOnlineId
Finds beatmaps where online ID matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byOnlineId(506483)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byRuleset
Finds beatmaps where ruleset matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byRuleset('osu')
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))bySetId
Finds beatmaps where set ID matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.bySetId('33333333-3333-4333-8333-333333333333')
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))bySetOnlineId
Finds beatmaps where set online ID matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.bySetOnlineId(506483)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byStarRatingAbove
Finds beatmaps where star rating is above the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byStarRatingAbove(5)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byStarRatingBelow
Finds beatmaps where star rating is below the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byStarRatingBelow(7)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byStarRatingBetween
Finds beatmaps where star rating is between the supplied bounds. You can chain more filters on the result.
return db.beatmaps.get
.byStarRatingBetween(5, 7)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byStatus
Finds beatmaps where status matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byStatus(1)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byTitle
Finds beatmaps where title matches the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byTitle('Make A Move')
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byTitleContains
Finds beatmaps where title contains the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byTitleContains('Move')
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byTotalObjectCountAbove
Finds beatmaps where total object count is above the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byTotalObjectCountAbove(500)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))byTotalObjectCountBelow
Finds beatmaps where total object count is below the supplied value. You can chain more filters on the result.
return db.beatmaps.get
.byTotalObjectCountBelow(1000)
.map(item => ({
title: item.Metadata?.Title,
difficulty: item.DifficultyName,
}))