Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mingo

Package Overview
Dependencies
Maintainers
1
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mingo

JavaScript query library using mongo-esque syntax

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
126K
decreased by-15.98%
Maintainers
1
Weekly downloads
 
Created

What is mingo?

Mingo is a JavaScript library that provides MongoDB-like query and aggregation capabilities for in-memory data processing. It allows you to filter, sort, group, and transform data collections using a syntax similar to MongoDB queries.

What are mingo's main functionalities?

Querying

This feature allows you to perform complex queries on your data collections. The example demonstrates how to filter a list of people to find those older than 26.

const mingo = require('mingo');
const data = [
  { name: 'John', age: 25 },
  { name: 'Jane', age: 30 },
  { name: 'Jim', age: 27 }
];
const query = new mingo.Query({ age: { $gt: 26 } });
const result = query.find(data).all();
console.log(result); // Output: [ { name: 'Jane', age: 30 }, { name: 'Jim', age: 27 } ]

Aggregation

This feature allows you to perform aggregation operations on your data collections. The example demonstrates how to calculate the average salary of people older than 26.

const mingo = require('mingo');
const data = [
  { name: 'John', age: 25, salary: 50000 },
  { name: 'Jane', age: 30, salary: 60000 },
  { name: 'Jim', age: 27, salary: 55000 }
];
const pipeline = [
  { $match: { age: { $gt: 26 } } },
  { $group: { _id: null, averageSalary: { $avg: '$salary' } } }
];
const result = mingo.aggregate(data, pipeline);
console.log(result); // Output: [ { _id: null, averageSalary: 57500 } ]

Projection

This feature allows you to project specific fields from your data collections. The example demonstrates how to retrieve only the 'name' and 'age' fields from a list of people.

const mingo = require('mingo');
const data = [
  { name: 'John', age: 25, salary: 50000 },
  { name: 'Jane', age: 30, salary: 60000 },
  { name: 'Jim', age: 27, salary: 55000 }
];
const query = new mingo.Query({});
const result = query.find(data).project({ name: 1, age: 1 }).all();
console.log(result); // Output: [ { name: 'John', age: 25 }, { name: 'Jane', age: 30 }, { name: 'Jim', age: 27 } ]

Other packages similar to mingo

Keywords

FAQs

Package last updated on 28 Oct 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc