Skip to content
This repository has been archived by the owner on Jan 15, 2024. It is now read-only.

Collection#insert should return the "_id" #129

Closed
mwlang opened this issue Dec 11, 2012 · 1 comment
Closed

Collection#insert should return the "_id" #129

mwlang opened this issue Dec 11, 2012 · 1 comment

Comments

@mwlang
Copy link

mwlang commented Dec 11, 2012

Currently Collection#insert returns nil.

It would be helpful for building compound documents if, when inserting a new document, Collection#insert returned either mongo document with the "_id" or just the "_id" field value so that the collection doesn't have to be re-queried to retrieve the value.

@durran
Copy link
Member

durran commented Dec 12, 2012

It would be nice, but unfortunately Mongo doesn't give us anything back when inserting (since it's fire and forget), and when in safe mode it still doesn't give the id back if it generated it on the server. So there really isn't any possible way for us to do this unless it was a core feature in MongoDB.

@durran durran closed this as completed Dec 12, 2012
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants