Multi-update exception 10145

46 views
Skip to first unread message

Victor Song

unread,
Jan 12, 2011, 7:41:41 PM1/12/11
to mongodb-user
MongoDB 1.6.5 on Linux 2.6.35-24-generic x86_64.
Trying to drop the last field of all documents.

> db.nasdaq.find({})
{ "_id" : ObjectId("4d2e1627b2ff40e4e4a1c287"), "Symbol" : "FLWS",
"Name" : "1-800 FLOWERS.COM, Inc.", "LastSale" : 2.48, "MarketCap" :
NumberLong(67265040), "IPOyear" : 1999, "Sector" : "Consumer
Services", "industry" : "Other Specialty Stores", "Summary Quote" :
"http://quotes.nasdaq.com/asp/SummaryQuote.asp?
symbol=FLWS&selected=FLWS", "" : "\r" }
{ "_id" : ObjectId("4d2e1627b2ff40e4e4a1c288"), "Symbol" : "FCTY",
"Name" : "1st Century Bancshares, Inc", "LastSale" : 4.004,
"MarketCap" : NumberLong(37525488), "IPOyear" : "n/a", "Sector" :
"Finance", "industry" : "Major Banks", "Summary Quote" : "http://
quotes.nasdaq.com/asp/SummaryQuote.asp?symbol=FCTY&selected=FCTY",
"" : "\r" }

> db.nasdaq.update({},{$pop: {field: 1}},false,true)
Wed Jan 12 19:38:21 [conn11] update stocks.nasdaq query: {} exception
10145 LEFT_SUBFIELD only supports Object 0ms
LEFT_SUBFIELD only supports Object

Thanks for any advice.

Eliot Horowitz

unread,
Jan 12, 2011, 9:00:55 PM1/12/11
to mongod...@googlegroups.com
What do you mean the last field?
The last entry in the map?
There isn't a way to do that.
$pop is for removing an element from an array.

> --
> You received this message because you are subscribed to the Google Groups "mongodb-user" group.
> To post to this group, send email to mongod...@googlegroups.com.
> To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>
>

Victor Song

unread,
Jan 12, 2011, 9:13:32 PM1/12/11
to mongodb-user
Deleted the last field/entry (caused by trailing commas of each line
in my CSV file) with

db.nasdaq.update({},{$unset: {"": 1}},false,true)

Victor Song

unread,
Jan 12, 2011, 9:29:59 PM1/12/11
to mongodb-user
Maybe mongoimport should ignore trailing and neighboring commas. I
wonder who uses empty keys in databases.

Eliot Horowitz

unread,
Jan 13, 2011, 12:37:04 AM1/13/11
to mongod...@googlegroups.com
Probably a good idea.
Can you add a case @ http://jira.mongodb.org/

On Wed, Jan 12, 2011 at 9:29 PM, Victor Song <yvs...@gmail.com> wrote:
> Maybe mongoimport should ignore trailing and neighboring commas. I
> wonder who uses empty keys in databases.
>

Nat

unread,
Jan 12, 2011, 8:01:51 PM1/12/11
to mongodb-user
you have to specify the name of the field you want to remove. "field"
doesn't exist in the document.

Nat

unread,
Jan 12, 2011, 8:18:30 PM1/12/11
to mongodb-user
- A field called "field" doesn't exist
- $pop has to be used on a field with an array type.

On Jan 13, 8:41 am, Victor Song <yvs...@gmail.com> wrote:
Reply all
Reply to author
Forward
0 new messages