0

I'm at the low end of the learning curve here, so please forgive the simplistic question.

I have set up my first Play application and have implemented their TodoList tutorial using a mongoDB database. My code basically mirrors this code: https://github.com/Mironor/Play-2.0-Scala-MongoDb-Salat-exemple.

The application works fine, but when I use the command line, I can't find any records:

$ mongo
> show dbs 
local   (empty)
todo    0.0625GB
> db.todo.find()
> db.todo.tasks.find()
>
  • I know the todo database is the one I want because when I drop it my data goes away.
  • I know there are records in there because I can see them in the application
  • I think I should find these records in db.todo.tasks because it is specified by the model

So how do I find these records from the command line console?

4

1 に答える 1

1

todoはデータベース、tasksはコレクションです。これを試して:

> use todo;
switched to db todo
> db.tasks.find();

MongoDB シェルでは、useコレクションを照会する前にデータベースを選択するコマンドが必要です。シェルを起動すると、おそらくtestデータベースで起動しているため、そこからタスクにアクセスする方法はありません。

于 2013-08-25T00:40:41.913 に答える