File tree 1 file changed +34
-0
lines changed
1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ //###############################################################################
2
+ //# Copyright 2017 Dell Inc.
3
+ //#
4
+ //# Licensed under the Apache License, Version 2.0 (the "License");
5
+ //# you may not use this file except in compliance with the License.
6
+ //# You may obtain a copy of the License at
7
+ //#
8
+ //# http://www.apache.org/licenses/LICENSE-2.0
9
+ //#
10
+ //# Unless required by applicable law or agreed to in writing, software
11
+ //# distributed under the License is distributed on an "AS IS" BASIS,
12
+ //# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ //# See the License for the specific language governing permissions and
14
+ //# limitations under the License.
15
+ //#
16
+ //###############################################################################
17
+ //EdgeX Mongo DB California AdminState and OperatingState migration script
18
+ //version 1
19
+ //author: Tyler Cox
20
+ db = db . getSiblingDB ( 'metadata' )
21
+ db . getCollectionNames ( ) . forEach ( function ( collname ) {
22
+ db [ collname ] . find ( { adminState : { $exists : true } } ) . forEach ( function ( doc ) {
23
+ db [ collname ] . updateMany (
24
+ { "_id" : doc . _id } ,
25
+ { $set : { "adminState" : doc . adminState . toUpperCase ( ) } }
26
+ ) ;
27
+ } ) ;
28
+ db [ collname ] . find ( { operatingState : { $exists : true } } ) . forEach ( function ( doc ) {
29
+ db [ collname ] . updateMany (
30
+ { "_id" : doc . _id } ,
31
+ { $set : { "operatingState" : doc . operatingState . toUpperCase ( ) } }
32
+ ) ;
33
+ } ) ;
34
+ } ) ;
You can’t perform that action at this time.
0 commit comments