RunJS notes & snippets draft

Last modified 1 year ago / Edit on Github
Danger icon
The last modifications of this post were around 1 year ago, some information may be outdated!
Danger icon
This is a draft, the content is not complete and of poor quality!
On this page
  1. MongoDB
  2. Lodash

RunJS is a wonderful playground application for testing quickly JavaScript and NodeJS.


👉 MongoDB official note

Setting up the environement variables first.

async function initMongoDb() {
const uri = `mongodb+srv://${process.env.IDETA_MONGO_USER}:${process.env.IDETA_MONGO_PASSWORD}@${process.env.IDETA_MONGO_HOST}`;
try {
const client = await MongoClient.connect(uri, {
useUnifiedTopology: true
return { client, db: client.db(`${process.env.IDETA_MONGO_DATABASE}`) };
} catch (e) {
throw e;

async function testMongo() {
const mongo = await initMongoDb();
return mongo.db.collection('agents').findOne({ active: false });

async function main() {
const agent = await testMongo();



👉 Lodash doc.

var _ = require('lodash');
// and then test with snippets on the doc
_.chunk(['a', 'b', 'c', 'd'], 2);

💬 Comments

Support Thi Support Thi