- Dev: cq-backend-dev-services-mysql
- Prod:cq-backend-prod-services-mysql
-
query: Array of strings.
Example:-
{query:["SELECT net_asset_value FROM nav_hist_2018_Q1 WHERE amfi_code = '112322'"]}
[
[
{
"net_asset_value": 24.7457
},
{
"net_asset_value": 24.3017
},
{
"net_asset_value": 23.9447
},
{
"net_asset_value": 24.0693
},
{
"net_asset_value": 24.1939
},
{
"net_asset_value": 24.2331
},
{
"net_asset_value": 21.4112
},
]
]
- Dev: cq-backend-dev-services-insert
- Prod:cq-backend-prod-services-insert
-
collection: Name of the collection(Required).
-
document: Document to be inserted(Required).
Example:-
{ collection:"user", document:{ name:"chandru" email:"[email protected]" } }
{
result:{
_id:"5c825e0f213827c4f32dfe42"
name:"chandru"
email:"[email protected]"
}
}
- Dev: cq-backend-dev-services-find
- Prod:cq-backend-prod-services-find
-
collection: Name of the collection(Required.).
-
query: Query to find proper document(Required)
-
id: Document Id if you need particular document when findType is findById
-
select: Specify the fields which are required
-
findType: Specify the find type(Required) [findAll,findOne,findById,count,distinct]
-
sort:Specify the sort order by field
-
limit:Speicify how many documents to get
-
skip: Specify how many documents to skip
-
uniqueField: Specify the field name when find type is distinct
{ collection:"user", query:{username:"chandru", findType:"findAll", sort:{_id:-1}, skip:10 limit:1 }
{ "result": [ { "_id": "5c7fa9e111d62b31b17cb4a5", "name": "chandru" }, { "_id": "5c7fab6211d62b16f467dc01", "name": "chandru" } ]}
{ collection:"user", query:{username:"chandru", findType:"findOne", }
{ result:{ _id:"5c825e0f213827c4f32dfe42" name:"chandru" email:"[email protected]" } }
{ collection:"user", _id:"5c825e0f213827c4f32dfe42", findType:"findById", }
{ result:{ _id:"5c825e0f213827c4f32dfe42" name:"chandru" email:"[email protected]" } }
{ collection:"user", query:{username:"chandru", findType:"count", }
{ "result": 2 }
{ collection:"user", query:{username:"chandru", findType:"distinct", uniqueField:"name" }
{
"result": [
"chandru"
]
}
- Dev: cq-backend-dev-services-update
- Prod:cq-backend-prod-services-update
-
collection: Name of the collection(Required.).
-
where: Query to find proper document(Required)
-
set: Field which need to be update(Required)
-
updateType: Specify the update type(Required) [updateOne,updateMany]
{ collection:"user", where:{username:"chandru"}, set:{email:"[email protected]", updateType:"updateMany" }
{ result:{ _id:"5c825e0f213827c4f32dfe42" name:"chandru" email:"[email protected]" } }
{ "result": "Updated successfully" }
{ result:{ _id:"5c825e0f213827c4f32dfe42" name:"chandru" email:"[email protected]" } }
- Dev: cq-backend-dev-services-remove
- Prod:cq-backend-prod-services-remove
-
collection: Name of the collection(Required.).
-
Query: Query to find proper document(Required)
-
removeType: Specify the remove type(Required) [removeOne,removeById,removeAll]
-
id : Document ID when remove type is removeById
{ collection:"user", where:{username:"chandru"}, removeType:"removeAll" }
{ "result": { "Updated": 0, "Removed": 1, "Matched": 1, "UpsertedId": null } }
{ collection:"user", where:{username:"chandru"}, removeType:"removeOne" }
{ "result": "Deleted successfully" }
{ { collection:"user", id:"5c825e0f213827c4f32dfe42", removeType:"removeById" } }
{ "result": "Deleted successfully" }
- Dev: cq-backend-dev-services-aggregate
- Prod:cq-backend-prod-services-aggregate
-
collection: Name of the collection(Required.).
-
operations: Array of operations required for aggregation(Required)
{ collection:"user", operations:[ {"$match":{status:"A"}}, {"$group":{_id:"$cust_id",total:{"$sum":"$amount"}}} ] }
{ result:[ { "_id" : "A123", "total" : 750 }, { "_id" : "B212", "total" : 200 } ] }