Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Fixed instance "saved" attribute in mongodb adapter #170

merged 1 commit into from

3 participants


Previously, instances were stored in the database with instance.saved = false. Even when they were obviously saved.

This commit fixes that issue. The problem was that we were setting

instance.saved = true

and then saving cleanInstance to the database.

Now it sets both instance.saved and cleanInstance.saved


We may not want to be saving it all (seeing as it's redundant). Should we just drop the "saved" attribute?


@mde is currently writing an ORM that's going to be used in Geddy so this may not be needed here anymore. But I'm not sure what he'd want to do here ATM.


Yes, I'm pulling all the Geddy model stuff out into its own project, "Model": But the 'saved' attribute is what the ORM uses to know if the instance is a new one, or has been previously saved. (We might consider making it an underscore property: "_saved".)

@mde mde merged commit b68adda into geddy:master

In the meantime, at least the current Geddy model stuff will behave correctly. Saving something in the DB with "saved" = false is crazypants. :)


w00t my first accepted pull request! :D If you're looking for help with Model just lemme know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 14, 2012
  1. @djrenren
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/model/adapters/mongo.js
2  lib/model/adapters/mongo.js
@@ -156,7 +156,7 @@ var Mongo = function (config) {
// if we don't already have the to do item, save a new one
else {
- instance.saved = true;
+ cleanInstance.saved = instance.saved = true;, function(err, docs){
return callback(err, instance);
Something went wrong with that request. Please try again.