Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't setup the config-persist-path to mongo #20

Open
Tumenbayev opened this issue Jul 3, 2018 · 3 comments
Open

Can't setup the config-persist-path to mongo #20

Tumenbayev opened this issue Jul 3, 2018 · 3 comments

Comments

@Tumenbayev
Copy link

Tumenbayev commented Jul 3, 2018

Hello! Thank you for this mock server.
I've successfully worked with mock server using file persistency. But, now I have some problems with a large size of files and I need to move my mock data to mongo.
But when I run server with 'config-persist-path' with mongo URL, finally in root directory i got folder named as 'mongo:'. When i start debugging, i see the following condition doesn't run if strings.Index(persistPath, "mongodb://") < 0 {.
Here how I execute server:
http-api-mock -config-persist-path mongodb://localhost/test
is it correct?
Sorry for my english :)

@vtrifonov
Copy link
Owner

Seems like there was a bug when reading the persist path which I just fixed in the master branch. Can you please try again?

@Tumenbayev
Copy link
Author

@vtrifonov, sorry for late response. Seems like everything is works fine, thank you!

@Tumenbayev Tumenbayev reopened this Jul 4, 2018
@Tumenbayev
Copy link
Author

One more question, how I should get the value of entity from collection?
{ "description": "Gets info about services", "request":{ "method":"GET", "path":"/v1/getAllServices.json" }, "persist": { "entity": "services/ObjectId('5b35c7a1c0c372304f8f0662')" }, "response": { "statusCode": 200, "headers": { "Content-Type": [ "application/json" ] }, "body": "{{ persist.entity.content }}" } }
After this query, mongo returns nothing. After read mongo logs i see this:
{ find: "services", filter: { _id: "ObjectId('5b35c7a1c0c372304f8f0662')" },
but query should be without quotes in filter, if I execute query without quotes, everything is ok.
Can u show me example how to define my persist file?

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

No branches or pull requests

2 participants