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

error in function create using scaffold with mongodb #619

Open
victor-carv opened this issue Apr 17, 2014 · 3 comments
Open

error in function create using scaffold with mongodb #619

victor-carv opened this issue Apr 17, 2014 · 3 comments

Comments

@victor-carv
Copy link

i'm trying to create a scaffold application with mongodb, like this:

compound init project --db mongodb
cd project
npm install
compound g scaffold person name

then i create a new person at localhost:3000/people/new
when i save the person i get the following error:

../node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/base.js:245
        throw message;      
              ^
TypeError: Cannot read property '0' of null
    at /project/node_modules/jugglingdb-mongodb/lib/mongodb.js:122:37
    at /project/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/collection/core.js:102:73
    at /project/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/db.js:1129:7
    at /project/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/db.js:1843:9
    at Server.Base._callHandler (/project/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/base.js:445:41)
    at /project/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/server.js:468:18
    at MongoReply.parseBody (/project/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
    at null.<anonymous> (/project/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/server.js:426:20)
    at EventEmitter.emit (events.js:95:17)
    at null.<anonymous> (/project/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:201:13)
    at EventEmitter.emit (events.js:98:17)
    at Socket.<anonymous> (/project/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/connection.js:422:22)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:746:14)
    at Socket.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:408:10)
    at emitReadable (_stream_readable.js:404:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)
    at TCP.onread (net.js:528:21)

in my database the person was saved, but with "id" null:

{
    "_id" : ObjectId("534fc9cbc1bb90b475a6bd82"),
    "name" : "teste",
    "id" : null
}

I'm using mongodb 2.6.0, ubuntu 13.04 and jugglingdb 0.2.13

@victor-carv victor-carv changed the title error in method create using scaffold with mongodb error in function create using scaffold with mongodb Apr 17, 2014
@randunel
Copy link
Collaborator

Hi,
Could you please remove that mongodb and install mongodb version 0.9.9?

rm -r node_modules/jugglingdb-mongodb/node_modules/mongodb
npm install [email protected]

@victor-carv
Copy link
Author

thanks,
now the call to create is ok, but id still null in the database:

{
    "_id" : ObjectId("53500a69119e279624000001"),
    "name" : "new test",
    "id" : null
}

@anatoliychakkaev
Copy link
Collaborator

It's mongo specific, as they use _id as id name.

On 17 April 2014 18:21, Victor Carvalho [email protected] wrote:

thanks,
now the call to create is ok, but id still null in the database:

{
"_id" : ObjectId("53500a69119e279624000001"),
"name" : "new test",
"id" : null
}


Reply to this email directly or view it on GitHubhttps://github.com//issues/619#issuecomment-40739216
.

victor-carv pushed a commit to victor-carv/mongodb-adapter that referenced this issue Apr 21, 2014
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

3 participants