-
-
Notifications
You must be signed in to change notification settings - Fork 132
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Thomas Poignant <[email protected]>
- Loading branch information
1 parent
605b1f5
commit bca8893
Showing
5 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
sidebar_position: 7 | ||
sidebar_position: 25 | ||
--- | ||
|
||
# File | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
--- | ||
sidebar_position: 7 | ||
--- | ||
|
||
# MongoDB | ||
The `mongodbRetriever` will use the mongoDB database to get your flags. | ||
|
||
## Example | ||
```go linenums="1" | ||
awsConfig, _ := config.LoadDefaultConfig(context.Background()) | ||
err := ffclient.Init(ffclient.Config{ | ||
PollingInterval: 3 * time.Second, | ||
Retriever: &mongodbretriever.Retriever{ | ||
Collection: "featureFlags", | ||
Database: "appConfig", | ||
URI: "mongodb://root:[email protected]:27017/", | ||
}, | ||
}) | ||
defer ffclient.Close() | ||
``` | ||
|
||
## Expected format | ||
If you use mongodb to store your flags, you need a specific format to store your flags. | ||
|
||
We expect the flag to be store in JSON format as defined in the [flag format](../configure_flag/flag_format#format-details), | ||
but you should also add a new field called ` "flag` containing the name of the flag. | ||
|
||
The retriever will read all the flags from the collection. | ||
|
||
### Example: | ||
```json | ||
{ | ||
"flag": "new-admin-access", | ||
"variations": { | ||
"default_var": false, | ||
"false_var": false, | ||
"true_var": true | ||
}, | ||
"defaultRule": { | ||
"percentage": { | ||
"false_var": 70, | ||
"true_var": 30 | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Configuration fields | ||
To configure your mongodb retriever: | ||
|
||
| Field | Description | | ||
|------------------|-------------------------------------------------------------| | ||
| **`Collection`** | Name of the collection where your flags are stored | | ||
| **`Database`** | Name of the mongo database where the collection is located. | | ||
| **`URI`** | Connection URI of your mongoDB instance. | |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.