New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@jolie/mongodb

Package Overview
Dependencies
Maintainers
5
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jolie/mongodb

Jolie MongoDB Connector

latest
npmnpm
Version
0.0.5
Version published
Maintainers
5
Created
Source

MongoConnector

This is the Jolie language MongoDB connector

Installation

jpm add @jolie/mongodb

Usage

from @jolie.mongodb.MongoConnector import MongoConnector

Operations


interface MongoDBInterface {
  RequestResponse:
  connect (ConnectRequest)(ConnectResponse) throws MongoException ,
  find   (FindRequest)(FindResponse)   throws MongoException JsonParseException ,
  insert  (InsertRequest)(InsertResponse)   throws MongoException JsonParseException IndexDuplicate,
  update  (UpdateRequest)(UpdateResponse)   throws MongoException JsonParseException IndexDuplicate,
  delete  (DelRequest)(DeleteResponse)   throws MongoException JsonParseException ,
  aggregate (AggregateRequest)(AggregateResponse) throws MongoException JsonParseException,
  
}

connect

This operation allows your service to connect to the to your instance of MongoDB

type ConnectRequest:void{
 .host ?: string
 .dbname : string
 .uri?:string
 .port ?:int
 .timeZone:string
 .jsonStringDebug?:bool
 .logStreamDebug?:bool
 .username?:string
 .password?:string
}
    connect@mongodb( { host= "localhost" 
                       port=27017 
                       dbname= "test" 
                       username = "test" 
                       password="test" 
                       timeZone ="Europe/Berlin" } )(  )

insert

This operation inserts a new document into a specific collection

type InsertRequest:void{
 .collection: string
 .document:undefined
}
   insert@mongodb( {collection = "test" 
                    document.nodeA = "nodeA" 
                    document.nodeB = 10 } )(  )

find

This operation allows you to search for documents in a specific collection that match a specific filter

type FindRequest:void{
  .collection: string
  .filter?:undefined
  .projection?:undefined
  .sort?:undefined
  .limit?: int
  .skip?:int
}
    find@mongodb( {collection = "test"
                  filter = "{nodeB : { $eq : '$nodeB' } }"
                  filter.nodeB= 10
                  projection="{_id:0}" } )( pipelineRequest.data  )

in this example we see how to pass a dinamically a parameter to the filter jsonObject

filter = "{nodeB : { $eq : '$nodeB' } }"

the format to pass parameter is '$parameterName' the paramater value need to be injected by passing as child node of filter node

filter.nodeB= 10

Keywords

mongodb

FAQs

Package last updated on 02 Jul 2021

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