mongogems 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/savedPipeline.rb +16 -5
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e52d3b09b0c7415673e2fb1ee195a179299157132d571ff13c992379018de51f
4
- data.tar.gz: 57811b85a6d413440b726e8cab1e574b9834d45cfa76fc1b30bfeca9f0f0f0c7
3
+ metadata.gz: fc20b0788d795db12040358deb32ed77388f13fb22ede8ed9d324176de5baabb
4
+ data.tar.gz: bd7984187737c6940c356527329c542236c6a284d712a29229c005121022ad45
5
5
  SHA512:
6
- metadata.gz: 2b887419212f6a2f6b9343d8e46771d12d4d854e10d8ec9cf8c5c1fbb2fe2cca856be3def29fd507eaac184a79d642689a195b7e569c798a37403d3019557ab6
7
- data.tar.gz: dfd7d7c251d96ca5dbf3313682bd97193112d6cb83dd6140ff5c66cff5ddfe0634cd2ac98ff9b83cdfce96d7d9ca0a09f3add292955eaf1e25f8ea83bab1c1dc
6
+ metadata.gz: fe38bbb5cc95e7fe2fba6e7c98a2e46f9ed340f97b77aed9102c2cf1b5d3d1626002a47053b927a8bb59ffd20ccc0dd1ad7d30493a6c8a0f38c7d4769983f80a
7
+ data.tar.gz: 785812a50bbe55a40ad81c462a1a618981c1ff9196871176d36696f419e942e2440fdd6ead609c41517cda5e7648e7ea10d73bfbf1be8f3a306b7c45ca245d0a
data/lib/savedPipeline.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+ # require 'hjson'
2
3
 
3
4
  # filename = '/Users/nitin/Downloads/Zaloni-DQ-A/607d7460cb21963a143d1d0f.json'
4
5
 
@@ -10,17 +11,27 @@ def pipeline_to_mongosh_script(infile, outfile)
10
11
  dbname = ns_split[0]
11
12
  collname = ns_split[1]
12
13
 
13
- the_pipeline = []
14
+ the_pipeline = "[\n"
15
+ is_first = true
14
16
  data['pipeline'].each do |pstage|
15
- the_pipeline.push pstage['executor']
17
+ if is_first
18
+ is_first = false
19
+ else
20
+ the_pipeline += ', '
21
+ end
22
+ stage_txt = pstage['stage']
23
+ stage_txt = stage_txt.gsub("\\r", "\r").gsub("\\n", "\n")
24
+ the_pipeline += "{ #{pstage['stageOperator']}: " + stage_txt + " }"
16
25
  end
26
+ the_pipeline += "\n]"
17
27
 
18
28
  mongosh_script_out =
19
- "
20
- //Query name: #{data['name']}
29
+ "//Query name: #{data['name']}
30
+
21
31
  use #{dbname};
32
+
22
33
  db.#{collname}.aggregate(
23
- #{JSON.generate the_pipeline}
34
+ " + the_pipeline + "
24
35
  , {allowDiskUse: true}
25
36
  );
26
37
  "
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mongogems
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katkam Nitin Reddy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-05-03 00:00:00.000000000 Z
11
+ date: 2021-05-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: