1

I have a Spring Boot app configured with default settings to use MongoDB. In order for my Spring Boot app to work, I have to manually launch MongoDB from terminal so I thought I could do commands from the shell to see what I was doing in the app. The app starts and performs all of the CRUD functions specified. When I launch mongo shell and do: use test

Test is the only db that list using

show collections

I then do:

db.test.find()

No records are listed, even though I get a dozen records back if I do a GET using Postman; therefore, the records are in mongoDB. I don't know how to run queries on the instance of mongoDB that Spring Boot is using (if it is different than the one I manually launched).

gohmer
  • 55
  • 1
  • 13
  • Are u using the correct db.. By this you are using the test database and the test collection.. Is this as expected – gpullen Aug 06 '15 at 21:20
  • I do "use test" before I run a command. I do "show dbs" to list dbs and I see test as the database. Did I miss something? – gohmer Aug 07 '15 at 22:05
  • When you run show collections - Do you have a collection called test? – gpullen Aug 10 '15 at 07:47

1 Answers1

-1

I just got a chance to work on mongodb recently. Not sure if you found a solution to your question. It seems that when you do the following command, you should get the list of your databases:

> show collections
mydb
xxxdb
restaurants
system.indexes

Then you can run the .find() command base on your db name. You should be able to get the data output on your terminal.

> db.mydb.find()

{ "_id" : ObjectId("1234"), "address" : { "building" : "351", "coord"...........}

If you don't like to use a Terminal, here is another NOSQL handy tool that I use - "Robomongo" - http://robomongo.org You can either run a query via the tool or just configure the UI for your data set.