release 2.6.8 / 2.7.0

2063 views
Skip to first unread message

Aaron Heckmann

unread,
Jun 15, 2012, 10:32:19 AM6/15/12
to mongoo...@googlegroups.com
Two releases are out. The first is a bugfix release (2.6.8). The second (2.7.0) is a big step toward our next major release. 


2.6.8 / 2012-06-14
===================

  * fixed; edge case when using 'options' as a path name (#961)


2.7.0 / 2012-06-14
===================

  * added; deprecation warnings to methods being removed in 3.x


In 2.7.0 we've introduced deprecation warnings (on by default) for all the methods being removed in version 3. To disable the warnings, set either the MONGOOSE_DEP_WARNINGS environment variable to false, or `mongoose.set('dep warnings', false)` in your code. 

This deprecation release means that v3 is almost here. I'll be publishing the alpha soon along as well as an upcoming series of blog posts about its changes and additions. You can get a general overview from the slides I used in my talk at JSConf.AR or by reading the summary of this pull request. The methods chosen to deprecate are 99% aliases in one form or another of other existing methods. This helps us get much closer to there being "one clear way" to do things. See the list of deprecated methods at the end of this message.

After the alpha is released, my focus (besides fixing bugs) will be rewriting the entire documentation site. The goal is to make it easier to keep up to date, mobile compatibility, richer descriptions, and more examples. If anyone has design skills, thoughts, or otherwise wants to help out, please jump in / ping me.


Deprecated methods:

    Query#$or                     Query#or
    Query#$nor                    Query#nor
    Query#$gt                     Query#gt
    Query#$gte                    Query#gte
    Query#$lt                     Query#lt
    Query#$lte                    Query#lte
    Query#$in                     Query#in
    Query#$nin                    Query#nin
    Query#$ne                     Query#ne
    Query#$all                    Query#all
    Query#$regex                  Query#regex
    Query#$size                   Query#size
    Query#$maxDistance            Query#maxDistance
    Query#$within                 Query#within
    Query#$box                    Query#box
    Query#$center                 Query#center
    Query#$centerSphere           Query#centerSphere
    Query#$slice                  Query#slice 
    Query#run                     Query#exec
    Query#notEqualTo              Query#notEqualTo
    Query#wherein                 Query#within
    Query#fields                  Query#select
    Query#asc                     Query#sort
    Query#desc                    Query#sort
    Query#only                    Query#select
    Query#exclude                 Query#select
    Query#each                    Query#stream
    MongooseArray#$push           MongooseArray#push
    MongooseArray#$pull           MongooseArray#pull
    MongooseArray#$pushAll        MongooseArray#push
    MongooseArray#pushAll         MongooseArray#push
    MongooseArray#$pullAll        MongooseArray#pull
    MongooseArray#pullAll         MongooseArray#pull
    MongooseArray#$unshift        MongooseArray#unshift
    MongooseArray#$addToSet       MongooseArray#addToSet
    Document#commit               MongooseArray#markModified
    Mongoose#connectSet           MongooseArray#connect
    Mongoose#createSetConnection  MongooseArray#createConnection
    MongooseNumber#$inc           removed
    MongooseNumber#increment      removed
    MongooseNumber#decrement      removed
    

--
Aaron



Aaron Heckmann

unread,
Jun 15, 2012, 10:35:06 AM6/15/12
to mongoo...@googlegroups.com
Correction, 

        deprecated                                            alternative

ben

unread,
Jun 15, 2012, 11:54:26 PM6/15/12
to mongoo...@googlegroups.com
Thanks for the great work :D
> --
> http://mongoosejs.com
> http://github.com/learnboost/mongoose
> You received this message because you are subscribed to the Google
> Groups "Mongoose Node.JS ORM" group.
> To post to this group, send email to mongoo...@googlegroups.com
> To unsubscribe from this group, send email to
> mongoose-orm...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/mongoose-orm?hl=en

Victor Powell

unread,
Jun 18, 2012, 1:27:43 AM6/18/12
to mongoo...@googlegroups.com
yeah, Aaron, way to do, dude!
--
Victor Powell

pgherveou

unread,
Jun 18, 2012, 1:11:43 PM6/18/12
to mongoo...@googlegroups.com
My Schema define some fields with the option select: false
this generates requests that call the exclude api method. 

*** Mongoose Query#exclude is deprecated. Use Query#select instead.

what the workaround for that ?

Aaron Heckmann

unread,
Jun 18, 2012, 1:53:35 PM6/18/12
to mongoo...@googlegroups.com
Set either the MONGOOSE_DEP_WARNINGS environment variable to false, or `mongoose.set('dep warnings', false)` in your code.

--
http://mongoosejs.com
http://github.com/learnboost/mongoose
You received this message because you are subscribed to the Google
Groups "Mongoose Node.JS ORM" group.
To post to this group, send email to mongoo...@googlegroups.com
To unsubscribe from this group, send email to
mongoose-orm...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/mongoose-orm?hl=en



--
Aaron



pgherveou

unread,
Jun 18, 2012, 1:55:42 PM6/18/12
to mongoo...@googlegroups.com
My concern was more how to update it to be compliant with 3.0 api

For more options, visit this group at
http://groups.google.com/group/mongoose-orm?hl=en



--
Aaron



Aaron Heckmann

unread,
Jun 18, 2012, 3:12:37 PM6/18/12
to mongoo...@googlegroups.com
its an implementation detail that is already updated on the 3.x branch.


For more options, visit this group at
http://groups.google.com/group/mongoose-orm?hl=en



--
Aaron



Pierre-guillaume HERVEOU

unread,
Jun 18, 2012, 5:23:55 PM6/18/12
to mongoo...@googlegroups.com
Great, thanks  Aaron

Aaron Heckmann

unread,
Aug 2, 2012, 5:33:31 PM8/2/12
to mongoo...@googlegroups.com

On Wed, Aug 1, 2012 at 5:27 PM, Kei Son <hey.ca...@gmail.com> wrote:
What is the reason why you pull off the #inc function from 3.x?

To provide the $inc/$dec methods we needed to sub-class the Number native. This leads to all sorts of non-intuitive bad behavior. For example, run this gist


Observe the result of `typeof a.n1`. Its "object" not "number"! Next observe a direct comparison of two mongoose numbers, `a.n1 == a.n2` is false. This makes javascript programs very sad. 

So the benefits of handy helper methods that are rarely used (though convenient) does not outweigh the broken behavior they exhibit, hence their removal.

I just pushed support for 3rd party plugins with atomics to continue working and published mongoose-number so your app still works. Note that the module requires a version of mongoose that is not yet released (only latest mongoose master contains the change).

Kei Son

unread,
Aug 4, 2012, 11:44:21 PM8/4/12
to mongoo...@googlegroups.com
I was in that situation often. So I get it. Thanks for explain.

But the other hand, when I want to increase a number of an object, I have to do like this `a.money += 10`, right?
It's less safe than the $inc does on a race condition. Should I consider the version control feature of that mongoose 3.x promises?
Too huge solution at this point!
It would be more nicer if mongoose replace the operation '$set' with '$inc' or '$dec' by compare between old and new on save time.

Thanks.
Kei

2012년 8월 3일 금요일 오전 6시 33분 31초 UTC+9, Aaron Heckmann 님의 말:

Aaron Heckmann

unread,
Aug 5, 2012, 11:52:40 AM8/5/12
to mongoo...@googlegroups.com

Versioning is only necessary for arrays.

Replacing $set with $inc/$dec would not correctly represent developer intention for most use cases. If there were a way to know when += was used we would all win but it triggers setters the same way = triggers setters.
--

Kei Son

unread,
Aug 5, 2012, 9:43:14 PM8/5/12
to mongoo...@googlegroups.com
then how can you deal with this situation?

MONGODB - "key":{value:10}

CLIENT1 - REQUEST buy an item with price 3
CLIENT2 - REQUEST buy an item with price 2
SERVER - fetch "key"
SERVER - fetch "key"
SERVER - got {value:10} and modify it to 7
SERVER - got {value:10} and modify it to 8
SERVER - save it with {value:7}
SERVER - save it with {value:8}

versioning(as a sort of STM) can handle this, $dec can handle this. what's your opinion?

2012년 8월 6일 월요일 오전 12시 52분 40초 UTC+9, Aaron Heckmann 님의 말:

Aaron Heckmann

unread,
Aug 6, 2012, 10:35:24 AM8/6/12
to mongoo...@googlegroups.com
Assuming accounts are not allowed to drop below zero:

Account.findOneAndUpdate({ _id: id, key: { gte: 3 }}, { $dec: { key: 3 }}, function (err, doc) {
  ...
})

Account.findOneAndUpdate({ _id: id, key: { gte: 2 }}, { $dec: { key: 2 }}, function (err, doc) {
  console.log(doc.key)
})

Mongoose-number supports $dec as well but I like the findAndModify helpers in this case.

Kei Son

unread,
Aug 6, 2012, 10:37:49 AM8/6/12
to mongoo...@googlegroups.com
OK. Thanks for your attention.

Sorry about being a troll I was in wrong thread :)

2012년 8월 6일 월요일 오후 11시 35분 24초 UTC+9, Aaron Heckmann 님의 말:

Aaron Heckmann

unread,
Aug 6, 2012, 12:25:30 PM8/6/12
to mongoo...@googlegroups.com
No need to apologize, those are good questions. :)
Reply all
Reply to author
Forward
0 new messages