Z
Z
zugzug2014-03-14 20:37:07
MongoDB
zugzug, 2014-03-14 20:37:07

Why doesn't MongoDB save documents on Windows?

Hello.
Given the following:
Windows x64, installed and running MongoDB with the following line:
D:\MongoDB\bin\mongod.exe --dbpath d:\MongoDB\data
In my Node.js application, I save the user to the 'users' collection:
MongoSave..
{ login: 'user17',
_id: 53233ca94be60a981d86b474,
settings: 'default_settings' }
POST /sign_up 200 38ms - 693b
Record added as { __v: 0,
login: 'user17',
_id: 53233ca94be60a981d86b474,
settings: 'default_settings' }
However, searching for documents returns an empty array:

UserModel
        .find({})
        .exec(function (err, users) {
            if (err) return console.error(err);
            console.log(users)
        });

Result:
[].
The same result both in the console and in the GUI utility, nothing is displayed there, although the collection exists.
I initialize and connect to the database like this:
var collections = ['users', 'user_profiles'];

mongoose.connect('mongodb://localhost/test1', collections);
var db = mongoose.connection;

A question for connoisseurs: what have I not taken into account yet, and why, as a result, my documents do not appear in the MongoDB database? Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2014-03-17
@zoonman

Try saving with option j=1 with logging confirmation.
docs.mongodb.org/manual/core/write-concern/#journaled
I would recommend using Robomongo and testing insert() in it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question