Skip to content
This repository has been archived by the owner on Feb 18, 2023. It is now read-only.
/ ordbok-mongodb Public archive

Orðbók Old Norse dictionary - MongoDB implementation

License

Notifications You must be signed in to change notification settings

stscoundrel/ordbok-mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Orðbók MongoDB

Old Norse dictionary for Node.js. MongoDB implementation.

Uses Orðbók for dictionary data.

Install

yarn add ordbok-mongodb

Usage

Set up the database:

const { toMongoDB } = require('ordbok-mongodb')

// Your MongoDB config.
const config = {
  url: '', // Your connection string.
  dbName: 'yourDBName', // Created if new.
  collectionName: 'yourCollectionName', // Created if new.
}

// Run only once to create & populate the database.
const res = await toMongoDB(config)
console.log(res)

Query the database:

const { getCollection } = require('ordbok-mongodb')

// Your MongoDB config.
const config = {...}

/**
 * Get collection & client instance.
 * You can also do it yourself without Orðbók.
 */
const { collection, client } = await getCollection(config)

// Any valid MongoDB query.
const wordsStartingWithS = await collection.find({ startsWith: 's' }).toArray()

console.log(wordsStartingWithS)

Schema for word entries:

{
    word: String,
    definition: String,
    type: String,
    gender: String,
    branch: String,
}

Sources

Scraped from word list compiled by Vikings of Bjornstad. The sources for the compiled list come from: