Skip to content

Add Nbomber example using MongoDB - #903

Merged
AntyaDev merged 3 commits into
devfrom
352-implement-nbomber-mongodb-example
Feb 26, 2026
Merged

AntyaDev merged 3 commits into
devfrom
352-implement-nbomber-mongodb-example

Conversation

@sanirr

@sanirr sanirr commented Oct 27, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

@sanirr
sanirr requested a review from AntyaDev October 27, 2025 14:17
@sanirr sanirr linked an issue Oct 27, 2025 that may be closed by this pull request
public string ConnectionString { get; set; }
public int DataSize { get; set; }
public int UsersCount { get; set; }
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add enter

.WithInit(async context =>
{
var config = context.GlobalCustomSettings.Get<MongoDBConfig>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty line

var config = context.GlobalCustomSettings.Get<MongoDBConfig>();

var client = new MongoClient(config.ConnectionString);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty line


var user = (await _users.FindAsync(x => x.Id == id)).FirstOrDefault();

if (user != null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return user != null
? Response.Ok(sizeBytes: user.Data.Length);
: Response.Fail();

.WithInit(context =>
{
_config = context.GlobalCustomSettings.Get<MongoDBConfig>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty lines

.WithInit(context =>
{
_config = context.GlobalCustomSettings.Get<MongoDBConfig>();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove empty lines


namespace Demo.DB.MongoDB
{
public class MongoDBWriteScenario

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MongoWriteScenario


namespace Demo.DB.MongoDB
{
public class MongoDBReadScenario

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MongoReadScenario

public int DataSize { get; set; }
public int UsersCount { get; set; }
}
public class MongoDBInitScenario

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MongoInitScenario

}
else
{
return Response.Fail();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Response.Fail(statusCode: "not_found")

@sanirr
sanirr force-pushed the 352-implement-nbomber-mongodb-example branch 3 times, most recently from 2b855b8 to 475e0eb Compare October 28, 2025 13:54
@sanirr
sanirr force-pushed the 352-implement-nbomber-mongodb-example branch from 475e0eb to 2c31c67 Compare October 28, 2025 13:56
@AntyaDev
AntyaDev merged commit b6aaf2f into dev Feb 26, 2026
1 check passed
@AntyaDev
AntyaDev deleted the 352-implement-nbomber-mongodb-example branch February 26, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement NBomber MongoDb example

2 participants