sanakirju-mongodb

0.9.0 • Public • Published

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).

Readme

Keywords

none

Package Sidebar

Install

npm i sanakirju-mongodb

Weekly Downloads

0

Version

0.9.0

License

MIT

Unpacked Size

5.61 kB

Total Files

13

Last publish

Collaborators

  • stscoundrel