transform-mango-selector-to-prisma
v1.0.17
Published
transform a mango selector to a prisma selector
Downloads
7
Maintainers
Readme
Mango Selector to Prisma Selector Converter
This package provides a utility function for converting Mango selectors (e.g. used by Apache CouchDB) to Prisma selectors.
Installation
Install the package via npm:
npm install transform-mango-selector-to-prisma
Usage
Import the transformMangoToSelector function from the package:
const transformMangoToSelector = require("transform-mango-selector-to-prisma")
// or
import { transformMangoToSelector } from "transform-mango-selector-to-prisma";
Pass your Mango selector to the transformMangoToSelector function:
const mangoSelector = {
$and: [
{ "userId": { $ne: 2 } },
{ "creatorId": 1 },
{
"items": {
$elemMatch: {
name: { $regex: "(?i)Apple" },
quantity: { $gt: 5 },
},
},
},
],
"lifecycle": { $gt: 0 },
};
const prismaSelector = transformMangoToSelector(mangoSelector);
The transformMangoToSelector function will convert your Mango selector to a Prisma selector. You can then use the prismaSelector in your Prisma queries.
License
This package is licensed under the MIT License