Skip to content

Commit

Permalink
feat: Remove deprecated Mongo code.
Browse files Browse the repository at this point in the history
Mongo DB is no longer a feature.

closes #2598

Signed-off-by: Lenny Goodell <leonard.goodell@intel.com>
  • Loading branch information
Lenny Goodell committed Dec 16, 2020
1 parent 1cb9438 commit 8825629
Show file tree
Hide file tree
Showing 53 changed files with 19 additions and 5,064 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ cd bin
./edge-launch.sh
```

**Note** You must have a database (Mongo or Redis) running before the services will operate
**Note** You must have a database (edis) running before the services will operate
correctly. If you don't want to install a database locally, you can host one via Docker. You may
also need to change the `configuration.toml` files for one or more of the services.

Expand All @@ -142,7 +142,7 @@ Follow the "Installation and Execution" steps above for obtaining and building t
make docker run_docker
```

**Note** The default behavior is to use Redis for the database, use the command `make EDGEX_DB=mongo run_docker` to start EdgeX with Mongo.
**Note** The default behavior is to use Redis for the database.

## Community

Expand Down
5 changes: 2 additions & 3 deletions bin/edgex-docker-launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@
# or implied. See the License for the specific language governing permissions and limitations under
# the License.

# Usage: bin/edgex-docker-launch.sh [mongo]
# Usage: bin/edgex-docker-launch.sh
#
# By default download the Redis based Docker Compose file and attempt to start EdgeX. If the mongo
# option is used, download the Mongo based Docker Compose file and attempt to start EdgeX.
# By default download the Redis based Docker Compose file and attempt to start EdgeX.
#
# To override the compose file entirely set the COMPOSE_FILE_PATH environment variable to the full
# pathname of the compose file you want to use.
Expand Down
2 changes: 1 addition & 1 deletion bin/edgex-launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
###
# Launches all EdgeX Go binaries (must be previously built).
#
# Expects that Consul and MongoDB are already installed and running.
# Expects that Consul and Redis are already installed and running.
#
###

Expand Down
3 changes: 0 additions & 3 deletions cmd/core-command/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ https://github.com/pkg/errors/blob/master/LICENSE
gorilla/mux (BSD-3) https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE

globalsign/mgo (unspecified) - https://github.com/globalsign/mgo
https://github.com/globalsign/mgo/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

Expand Down
3 changes: 0 additions & 3 deletions cmd/core-data/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ https://github.com/pkg/errors/blob/master/LICENSE
gorilla/mux (BSD-3) - https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE

globalsign/mgo (unspecified) - https://github.com/globalsign/mgo
https://github.com/globalsign/mgo/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

Expand Down
3 changes: 0 additions & 3 deletions cmd/core-metadata/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ https://github.com/pkg/errors/blob/master/LICENSE
gorilla/mux (BSD-3) https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE

globalsign/mgo (unspecified) - https://github.com/globalsign/mgo
https://github.com/globalsign/mgo/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

Expand Down
3 changes: 0 additions & 3 deletions cmd/secrets-config/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ https://github.com/pkg/errors/blob/master/LICENSE
gorilla/mux (BSD-3) - https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE

globalsign/mgo (unspecified) - https://github.com/globalsign/mgo
https://github.com/globalsign/mgo/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

Expand Down
3 changes: 0 additions & 3 deletions cmd/security-bootstrap-redis/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ https://github.com/pkg/errors/blob/master/LICENSE
gorilla/mux (BSD-3) - https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE

globalsign/mgo (unspecified) - https://github.com/globalsign/mgo
https://github.com/globalsign/mgo/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

Expand Down
3 changes: 0 additions & 3 deletions cmd/security-file-token-provider/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ https://github.com/pkg/errors/blob/master/LICENSE
gorilla/mux (BSD-3) - https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE

globalsign/mgo (unspecified) - https://github.com/globalsign/mgo
https://github.com/globalsign/mgo/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

Expand Down
3 changes: 0 additions & 3 deletions cmd/security-proxy-setup/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ https://github.com/pkg/errors/blob/master/LICENSE
gorilla/mux (BSD-3) - https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE

globalsign/mgo (unspecified) - https://github.com/globalsign/mgo
https://github.com/globalsign/mgo/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

Expand Down
3 changes: 0 additions & 3 deletions cmd/security-secrets-setup/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ https://github.com/pkg/errors/blob/master/LICENSE
gorilla/mux (BSD-3) - https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE

globalsign/mgo (unspecified) - https://github.com/globalsign/mgo
https://github.com/globalsign/mgo/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

Expand Down
3 changes: 0 additions & 3 deletions cmd/security-secretstore-setup/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ https://github.com/pkg/errors/blob/master/LICENSE
gorilla/mux (BSD-3) - https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE

globalsign/mgo (unspecified) - https://github.com/globalsign/mgo
https://github.com/globalsign/mgo/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

Expand Down
3 changes: 0 additions & 3 deletions cmd/support-notifications/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ https://github.com/pkg/errors/blob/master/LICENSE
gorilla/mux (BSD-3) https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE

globalsign/mgo (unspecified) - https://github.com/globalsign/mgo
https://github.com/globalsign/mgo/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

Expand Down
3 changes: 0 additions & 3 deletions cmd/support-scheduler/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ https://github.com/pkg/errors/blob/master/LICENSE
gorilla/mux (BSD-3) https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE

globalsign/mgo (unspecified) - https://github.com/globalsign/mgo
https://github.com/globalsign/mgo/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

Expand Down
3 changes: 0 additions & 3 deletions cmd/sys-mgmt-agent/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ https://github.com/pkg/errors/blob/master/LICENSE
gorilla/mux (BSD-3) https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE

globalsign/mgo (unspecified) - https://github.com/globalsign/mgo
https://github.com/globalsign/mgo/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

Expand Down
3 changes: 0 additions & 3 deletions cmd/sys-mgmt-executor/Attribution.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ https://github.com/pkg/errors/blob/master/LICENSE
gorilla/mux (BSD-3) https://github.com/gorilla/mux
https://github.com/gorilla/mux/blob/master/LICENSE

globalsign/mgo (unspecified) - https://github.com/globalsign/mgo
https://github.com/globalsign/mgo/blob/master/LICENSE

pebbe/zmq4 (BSD-2) https://github.com/pebbe/zmq4
https://github.com/pebbe/zmq4/blob/master/LICENSE.txt

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
github.com/edgexfoundry/go-mod-registry v0.1.26
github.com/edgexfoundry/go-mod-secrets v0.0.26
github.com/fxamacker/cbor/v2 v2.2.0
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8
github.com/gomodule/redigo v2.0.0+incompatible
github.com/google/uuid v1.1.2
github.com/gorilla/mux v1.8.0
Expand Down
10 changes: 6 additions & 4 deletions internal/core/data/device_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ import (

"github.com/edgexfoundry/edgex-go/internal/core/data/config"
"github.com/edgexfoundry/edgex-go/internal/pkg/db"
"github.com/google/uuid"

"github.com/edgexfoundry/go-mod-core-contracts/clients/logger"
contract "github.com/edgexfoundry/go-mod-core-contracts/models"

"github.com/globalsign/mgo/bson"
)

var testEvent contract.Event
Expand Down Expand Up @@ -59,7 +58,9 @@ func reset() {

func buildReadings() []contract.Reading {
ticks := db.MakeTimestamp()
r1 := contract.Reading{Id: bson.NewObjectId().Hex(),

id, _ := uuid.NewUUID()
r1 := contract.Reading{Id: id.String(),
Name: "Temperature",
Value: "45",
Origin: testOrigin,
Expand All @@ -68,7 +69,8 @@ func buildReadings() []contract.Reading {
Pushed: ticks,
Device: testDeviceName}

r2 := contract.Reading{Id: bson.NewObjectId().Hex(),
id, _ = uuid.NewUUID()
r2 := contract.Reading{Id: id.String(),
Name: "Pressure",
Value: "1.01325",
Origin: testOrigin,
Expand Down
10 changes: 4 additions & 6 deletions internal/core/data/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ import (
dataMocks "github.com/edgexfoundry/edgex-go/internal/core/data/mocks"
correlation "github.com/edgexfoundry/edgex-go/internal/pkg/correlation/models"
"github.com/edgexfoundry/edgex-go/internal/pkg/db"
"github.com/google/uuid"

"github.com/edgexfoundry/go-mod-core-contracts/clients/logger"
contract "github.com/edgexfoundry/go-mod-core-contracts/models"
"github.com/edgexfoundry/go-mod-messaging/messaging"
msgTypes "github.com/edgexfoundry/go-mod-messaging/pkg/types"

"github.com/globalsign/mgo/bson"
"github.com/stretchr/testify/mock"
)

Expand Down Expand Up @@ -275,7 +275,7 @@ func TestAddEventNoPersistence(t *testing.T) {
wg.Add(1)
go handleDomainEvents(bitEvents, chEvents, &wg, t)

newId, err := addNewEvent(
_, err := addNewEvent(
correlation.Event{Event: evt},
context.Background(),
logger.NewMockClient(),
Expand All @@ -292,9 +292,6 @@ func TestAddEventNoPersistence(t *testing.T) {
if err != nil {
t.Errorf(err.Error())
}
if bson.IsObjectIdHex(newId) {
t.Errorf("unexpected bson id %s received", newId)
}

wg.Wait()
for i, val := range bitEvents {
Expand All @@ -311,7 +308,8 @@ func TestUpdateEventNotFound(t *testing.T) {
dbClientMock := &dbMock.DBClient{}
dbClientMock.On("EventById", mock.Anything).Return(contract.Event{}, fmt.Errorf("Event not found"))

evt := contract.Event{ID: bson.NewObjectId().Hex(), Device: "Not Found", Origin: testOrigin}
id, _ := uuid.NewUUID()
evt := contract.Event{ID: id.String(), Device: "Not Found", Origin: testOrigin}
err := updateEvent(
correlation.Event{Event: evt},
context.Background(),
Expand Down
3 changes: 1 addition & 2 deletions internal/core/data/mocks/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import (
"github.com/edgexfoundry/go-mod-core-contracts/clients/types"
contract "github.com/edgexfoundry/go-mod-core-contracts/models"

"github.com/globalsign/mgo/bson"
"github.com/google/uuid"
"github.com/stretchr/testify/mock"

Expand All @@ -38,7 +37,7 @@ func NewMockDeviceClient() *mocks.DeviceClient {
protocols := getProtocols()

mockDeviceResultFn := func(ctx context.Context, id string) contract.Device {
if bson.IsObjectIdHex(id) {
if len(id) > 0 {
return contract.Device{Id: id, Name: testDeviceName, Protocols: protocols}
}
return contract.Device{}
Expand Down
3 changes: 1 addition & 2 deletions internal/core/data/v2/application/mocks/deviceClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/edgexfoundry/go-mod-core-contracts/clients/types"
contract "github.com/edgexfoundry/go-mod-core-contracts/models"

"github.com/globalsign/mgo/bson"
"github.com/google/uuid"
"github.com/stretchr/testify/mock"
)
Expand All @@ -30,7 +29,7 @@ func NewMockDeviceClient() *mocks.DeviceClient {
protocols := getProtocols()

mockDeviceResultFn := func(ctx context.Context, id string) contract.Device {
if bson.IsObjectIdHex(id) {
if len(id) > 0 {
return contract.Device{Id: id, Name: testDeviceName, Protocols: protocols}
}
return contract.Device{}
Expand Down
3 changes: 1 addition & 2 deletions internal/core/data/v2/mocks/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import (
"github.com/edgexfoundry/go-mod-core-contracts/clients/types"
contract "github.com/edgexfoundry/go-mod-core-contracts/models"

"github.com/globalsign/mgo/bson"
"github.com/google/uuid"
"github.com/stretchr/testify/mock"
)
Expand All @@ -32,7 +31,7 @@ func NewMockDeviceClient() *mocks.DeviceClient {
protocols := getProtocols()

mockDeviceResultFn := func(ctx context.Context, id string) contract.Device {
if bson.IsObjectIdHex(id) {
if len(id) > 0 {
return contract.Device{Id: id, Name: testDeviceName, Protocols: protocols}
}
return contract.Device{}
Expand Down
12 changes: 0 additions & 12 deletions internal/pkg/bootstrap/handlers/database/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import (
"github.com/edgexfoundry/edgex-go/internal/pkg/bootstrap/interfaces"
"github.com/edgexfoundry/edgex-go/internal/pkg/db"
dbInterfaces "github.com/edgexfoundry/edgex-go/internal/pkg/db/interfaces"
"github.com/edgexfoundry/edgex-go/internal/pkg/db/mongo"
"github.com/edgexfoundry/edgex-go/internal/pkg/db/redis"

bootstrapContainer "github.com/edgexfoundry/go-mod-bootstrap/bootstrap/container"
Expand Down Expand Up @@ -72,17 +71,6 @@ func (d Database) newDBClient(

databaseInfo := d.database.GetDatabaseInfo()["Primary"]
switch databaseInfo.Type {
// Deprecated: Mongo functionality is deprecated as of the Geneva release.
case db.MongoDB:
return mongo.NewClient(
db.Configuration{
Host: databaseInfo.Host,
Port: databaseInfo.Port,
Timeout: databaseInfo.Timeout,
DatabaseName: databaseInfo.Name,
Username: credentials.Username,
Password: credentials.Password,
})
case db.RedisDB:
conf := db.Configuration{
Host: databaseInfo.Host,
Expand Down
4 changes: 0 additions & 4 deletions internal/pkg/db/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ import (
const (
// Databases

// MongoDB the unique identifier used in configuring the system to signal the underlying database used is MongoDB.
//
// Deprecated: Mongo functionality is deprecated as of the Geneva release.
MongoDB = "mongodb"
RedisDB = "redisdb"

// Data
Expand Down
Loading

0 comments on commit 8825629

Please sign in to comment.