0.0.15 • Published 3 years ago
ndjsonql v0.0.15
Command-Line Usage
# install it
npm install --global ndjsonql
# run it
ndjsonql --file data.ndjson --output output.ndjson --pipelines pipelines.json
Library Usage
const ndjsonql = require('ndjsonql');
const matchPipeline = new ndjsonql.MatchPipeline({
"email": { "$contains": "example.com" },
});
const result = matchPipeline.execute({
"email": "foo.bar@example.com",
});
if (result) {
console.log('MATCHED!');
}
Operators
Sample Data Set
{"dob":{"date":"1973-10-26T18:22:45.026Z","age":48},"email":"marijana.meyer@example.com","gender":"female","name":{"title":"Madame","first":"Marijana","last":"Meyer"}}
{"dob":{"date":"1974-05-06T21:54:30.954Z","age":47},"email":"eileen.ryan@example.com","gender":"female","name":{"title":"Mrs","first":"Eileen","last":"Ryan"}}
{"dob":{"date":"1988-09-26T21:31:05.349Z","age":33},"email":"ivy.zhang@example.com","gender":"female","name":{"title":"Ms","first":"Ivy","last":"Zhang"}}
{"dob":{"date":"1952-01-03T09:46:27.250Z","age":69},"email":"cecilie.jensen@example.com","gender":"female","name":{"title":"Ms","first":"Cecilie","last":"Jensen"}}
{"dob":{"date":"1992-08-25T18:05:00.430Z","age":29},"email":"rixt.opdam@example.com","gender":"female","name":{"title":"Miss","first":"Rixt","last":"Opdam"}}
$contains
{
"$match": {
"email": { "$contains": "example.com" }
}
}
$eq
{
"$match": {
"gender": { "$eq": "female" }
}
}
$exists
{
"$match": {
"email": { "$exists": true }
}
}
$gt
{
"$match": {
"dob.age": { "$gt": 30 }
}
}
$gte
{
"$match": {
"dob.age": { "$gte": 30 }
}
}
$lt
{
"$match": {
"dob.age": { "$lt": 30 }
}
}
$lte
{
"$match": {
"dob.age": { "$lte": 30 }
}
}
$ne
{
"$match": {
"gender": { "$ne": "female" }
}
}
License
ndjsonql is open-source software distributed under the terms of the MIT license.