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

stscoundrel/sanakirju-mongodb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sanakirju MongoDB

MongoDB implementation of Sanakirju, a Karelian - Finnish dictionary with over 90 000 words. Based on data from Karjalan Kielen Sanakirja.

Install

yarn add sanakirju-mongodb

Usage

Set up the database:

const { toMongoDB } = require('sanakirju-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('sanakirju-mongodb')

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

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

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

console.log(wordsStartingWithU)

Sources.

Words & translations are from Karjalan Kielen Sanakirja created by Institute for the Languages of Finland. The original material is licenced under Creative Commons International (CC BY 4.0).

About

MongoDB implementation of Sanakirju dictionary.

Resources

License

Stars

Watchers

Forks

Packages

No packages published