Skip to content

Commit

Permalink
comments clarified
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Aug 26, 2023
1 parent 8eba5d4 commit acfdc94
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ All images are available at https://hub.docker.com/r/tinode/
$ docker network create tinode-net
```

3. Decide which database backend you want to use: RethinkDB, MySQL or MongoDB. Run the selected database container, attaching it to `tinode-net` network:
3. Decide which database backend you want to use: MySQL, PostgreSQL, MongoDB or RethinkDB. Run the selected database container, attaching it to `tinode-net` network:

1. **MySQL**: If you've decided to use MySQL backend, run the official MySQL Docker container:
```
Expand Down
2 changes: 1 addition & 1 deletion server/auth/code/auth_code.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ func (authenticator) GetResetParams(uid types.Uid) (map[string]interface{}, erro
return nil, nil
}

// Replace all occurences of % with / to ensure SQL LIKE query works correctly.
// Replace all occurrences of '%' with '/' to ensure SQL LIKE query works correctly.
func sanitizeKey(key string) string {
return strings.ReplaceAll(key, "%", "/")
}
Expand Down
7 changes: 4 additions & 3 deletions server/db/rethinkdb/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -2734,8 +2734,9 @@ func (a *adapter) FileDeleteUnused(olderThan time.Time, limit int) ([]string, er
return locations, err
}

// Given a select query against 'messages' table, decrement corresponding use counter in 'fileuploads' table.
func (a *adapter) decFileUseCounter(msgQuery rdb.Term) error {
// Given a select query, decrement corresponding use counter in 'fileuploads' table.
// The 'query' must return an array, i.e. GetAll, not Get.
func (a *adapter) decFileUseCounter(query rdb.Term) error {
/*
r.db("test").table("one")
.getAll(
Expand All @@ -2753,7 +2754,7 @@ func (a *adapter) decFileUseCounter(msgQuery rdb.Term) error {
*/
_, err := rdb.DB(a.dbName).Table("fileuploads").GetAll(
rdb.Args(
msgQuery.
query.
// Fetch messages with attachments only
Filter(rdb.Row.HasFields("Attachments")).
// Flatten arrays
Expand Down
4 changes: 2 additions & 2 deletions server/tinode.conf
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,8 @@
// MongoDB configuration.
"mongodb": {
// Connection string https://www.mongodb.com/docs/manual/reference/connection-string/
// Options configured with the connection string override any other options
// (only 'uri' is used to the server, all other options ignored).
// Options configured with the 'uri' connection string override all other options
// (only 'uri' is sent to the server, all other options are ignored).
// If you are using Atlas, then you MUST use 'uri' to connect. See here:
// https://www.mongodb.com/docs/manual/reference/connection-string/#std-label-connections-dns-seedlist
// Something like
Expand Down

0 comments on commit acfdc94

Please sign in to comment.