Skip to content
/ phql Public

Convert a string of a specific format to the data filter parameter form of MongoDB.

License

Notifications You must be signed in to change notification settings

DvShu/phql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

phql

Convert a string of a specific format to the data filter parameter form of MongoDB.

English

Installation

yarn add phql

Usage

Usually used for client dynamic acquisition of required fields in web applications.

let parseQl = require('phql');
let filterObj = parseQl('{name,age,sex,info{weight,height}}')

Specific Format String

{name,age,sex,info{weight,height}}

Parsed Result

MongoDB projections

{
  name: 1,
  age: 1,
  sex: 1,
  info: {
    weight: 1,
    height: 1
  }
}

简体中文

通常用于在使用 MongoDBWEB 应用程序中,客户端动态获取自己所需要的字段;这个时候客户端可以传递特定格式的字符串,然后服务端解析该字符串为 MongoDB Projections 的形式传递给 MongoDb

License

MIT

About

Convert a string of a specific format to the data filter parameter form of MongoDB.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published