# MongoDB jEDI Driver
Updated: 2/24/2021, 3:51:59 PM
Created: 2/24/2021, 3:51:59 PM
Last Updated By: Daniel Klein
Read Time: 3 minute(s)
# Document Scope
MongoDB jEDI datasheet
# Description
How to use the MongoDB jEDI
# Details
- Create a file
jsh jbase ~/mongo -->create-file mydemo type=mongo
Notice: Assuming options 'collection=mydemo]D database=jbase write=schema'
[ 417 ] File mydemo]D created , type = OBJECT
Notice: Assuming options 'collection=mydemo database=jbase write=schema'
[ 417 ] File mydemo created , type = OBJECT
1
2
3
4
5
2
3
4
5
- Populate the file with test data
jsh jbase ~/mongo -->make-demo-file 10000 mydemo (C
10,000 processed
10,000 records created.
1
2
3
2
3
- From a Mongo shell, we can see the data.
> db.mydemo.find()
{ "_id" : "00001", "_type" : "named", "_attr00001" : "GREG", "_attr00002" : "BAILEY", "_attr00003" : "10260 SW GREENBURG RD", "_attr00004" : "LEVEL 42", "_attr00005" : "NEW YORK", "_attr00006" : "NY", "_attr00007" : 44223, "_attr00008" : "(125) 555-1337", "_attr00009" : "(524) 555-2437", "_attr00010" : "[email protected]", "_attr00011" : [ "DIGITAL", "PSERIES", "XSERIES", "ASUS", "SPARC" ], "_attr00012" : [ "LINUX RH9", "LINUX RH9", "TRU64", "TRU64", "LINUX RH9" ], "_attr00013" : [ "jBASE", "QM", "ROS", "ROS", "D3" ], "_attr00014" : [ 416, 1470, 271, 1296, 961 ] }
{ "_id" : "00002", "_type" : "named", "_attr00001" : "TERRY", "_attr00002" : "WALKER", "_attr00003" : "123 MAIN ST", "_attr00004" : "SUITE 23", "_attr00005" : "SPRINGFIELD", "_attr00006" : "IL", "_attr00007" : 24358, "_attr00008" : "(524) 555-2437", "_attr00009" : "(666) 246-0149", "_attr00010" : "[email protected]", "_attr00011" : "ISERIES", "_attr00012" : "LINUX RH8", "_attr00013" : "IN2", "_attr00014" : 1612 }
1
2
3
2
3
[ Screen shot truncated ]
- We can do anything with the data that we could for any hash file
jsh jbase ~/mongo -->COUNT mydemo
10000 Records counted
jsh jbase ~/mongo -->SELECT mydemo WITH LASTNAME EQ "MURPHY"
759 Records selected
>DELETE mydemo
759 record(s) deleted.
jsh jbase ~/mongo -->COUNT mydemo
9241 Records counted
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
- Run jQL against it. Note that the DICT section is also a mongo file (or collection as they call it)
jsh jbase ~/mongo -->LIST mydemo FIRSTNAME LASTNAME EMAIL OS
PAGE 1 20:26:59 19 DEC 2019
mydemo........ First Name.............. Last Name........... Email................. OS.............
00001 GREG BAILEY [email protected] LINUX RH9
LINUX RH9
TRU64
TRU64
LINUX RH9
00002 TERRY WALKER [email protected] LINUX RH8
00003 TED FLETCHER [email protected] AIX
1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
- As with JD files, you can create a dynamic object and write that directly to a Mongo file. When we do this, we get named fields in mongo.
$ cat test8.jabba
filename = "mydemo"
open filename to dscb else stop 201,filename
rec = new object
rec->Name = "Greg"
rec->Age = 55
write rec on dscb,"greg"
1
2
3
4
5
6
7
2
3
4
5
6
7
And from the Mongo shell.
> db.mydemo.find()
{ "_id" : "greg", "Name" : "Greg", "Age" : 55, "_type" : "object" }
1
2
2
- To emphasise this point, the (O) option to make-demo-file now creates a dynamic object and writes it to the file instead of multivalue data. Again, we can see it writes named fields to Mongo
> db.mydemo.find()
{ "_id" : "01", "firstname" : "DELLA", "lastname" : "BAILEY", "addr1" : "42 MILLI WAYS", "addr2" : "#1020", "city" : "LOS ANGLES", "state" : "MI", "zip" : "12345", "hometel" : "(666) 246-0149", "worktel" : "(666) 246-0149", "email" : "[email protected]", "hardware" : [ "XSERIES" ], "os" : [ "AIX" ], "systemtype" : [ "QM" ], "numusers" : [ 1973 ], "_type" : "object" }
{ "_id" : "02", "firstname" : "CLIVE", "lastname" : "AUBERT", "addr1" : "10260 SW GREENBURG RD", "addr2" : "LEVEL 42", "city" : "SPRINGFIELD", "state" : "CA", "zip" : "12345", "hometel" : "(524) 555-2437", "worktel" : "(124) 555-1337", "email" : "[email protected]", "hardware" : [ "ISERIES", "SOLARIS", "SPARC", "SOLARIS", "ASUS" ], "os" : [ "NT", "HPUX", "NT", "LINUX RH9", "LINUX RH8" ], "systemtype" : [ "jBASE", "ROS", "QM", "D3", "jBASE" ], "numusers" : [ 1691, 618, 1982, 845, 952 ], "_type" : "object" }
1
2
3
2
3
# Note
Upcoming Feature Development:
- Sub-value support
- Improved transformation speed