From 020559ac582a1c9fde86f21cce3e28621aa7246d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Lebel?= Date: Thu, 5 Mar 2015 01:50:48 +0100 Subject: [PATCH] support for Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.NaN https://github.com/jeromelebel/MongoHub-Mac/issues/206 --- Libraries/MongoObjCDriver | 2 +- README.markdown | 5 ++++- Sources/Helpers/MODHelper.m | 10 +++++++++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Libraries/MongoObjCDriver b/Libraries/MongoObjCDriver index 9e8367e1..104d9cdf 160000 --- a/Libraries/MongoObjCDriver +++ b/Libraries/MongoObjCDriver @@ -1 +1 @@ -Subproject commit 9e8367e1dc435308fb637fbc231905563a788652 +Subproject commit 104d9cdf8e665ed1a2472b6a50b737d841944d55 diff --git a/README.markdown b/README.markdown index f5d8f481..e90238a7 100644 --- a/README.markdown +++ b/README.markdown @@ -60,18 +60,21 @@ Please send me a [pull request](https://github.com/jeromelebel/MongoHub-Mac/pull - Crash fix for [issue #200](https://github.com/jeromelebel/MongoHub-Mac/issues/200) - Fix to create a new database with mongodb 3.0 [issue #203](https://github.com/jeromelebel/MongoHub-Mac/issues/203) - Better json editor feedback, when saving a documetn [issue #201](https://github.com/jeromelebel/MongoHub-Mac/issues/201) +- Copying documents are now in a json array (using the pasteboard) [issue #195](https://github.com/jeromelebel/MongoHub-Mac/issues/195) +- Support for Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.NaN [issue #206](https://github.com/jeromelebel/MongoHub-Mac/issues/206) **3.1 Beta** - Crash fix for [issue #200](https://github.com/jeromelebel/MongoHub-Mac/issues/200) - Fix to create a new database with mongodb 3.0 [issue #203](https://github.com/jeromelebel/MongoHub-Mac/issues/203) - Better json editor feedback, when saving a documetn [issue #201](https://github.com/jeromelebel/MongoHub-Mac/issues/201) +- Support for Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY, Number.NaN [issue #206](https://github.com/jeromelebel/MongoHub-Mac/issues/206) ## History **3.1 beta 3 - february 19, 2015** -- Documents are copied inside an array (using the pasteboard) [issue #195](https://github.com/jeromelebel/MongoHub-Mac/issues/195) +- Copying documents are now in a json array (using the pasteboard) [issue #195](https://github.com/jeromelebel/MongoHub-Mac/issues/195) - Fix for a crash when the server is not valid [issue #196](https://github.com/jeromelebel/MongoHub-Mac/issues/196) - Fix for a crash when changingn the collection name [issue #193](https://github.com/jeromelebel/MongoHub-Mac/issues/193) - Fix for a crash when editing a document [issue #198](https://github.com/jeromelebel/MongoHub-Mac/issues/198) diff --git a/Sources/Helpers/MODHelper.m b/Sources/Helpers/MODHelper.m index 67f5547e..b410c011 100644 --- a/Sources/Helpers/MODHelper.m +++ b/Sources/Helpers/MODHelper.m @@ -82,7 +82,15 @@ + (NSMutableDictionary *)convertForOutlineWithValue:(id)dataValue dataKey:(NSStr if ([dataValue isKindOfClass:[NSNumber class]]) { if (strcmp([dataValue objCType], @encode(double)) == 0 || strcmp([dataValue objCType], @encode(float)) == 0) { type = @"Double"; - value = [dataValue description]; + if ([dataValue doubleValue] == INFINITY) { + value = @"Number.POSITIVE_INFINITY"; + } else if ([dataValue doubleValue] == -INFINITY) { + value = @"Number.NEGATIVE_INFINITY"; + } else if (isnan([dataValue doubleValue])) { + value = @"Number.NaN"; + } else { + value = [dataValue description]; + } } else if (strcmp([dataValue objCType], @encode(int)) == 0) { type = @"Integer"; value = [dataValue description];