How to add a nested object?

10 views
Skip to first unread message

Dan Gal

unread,
Apr 2, 2015, 9:55:57 AM4/2/15
to mongo...@googlegroups.com
I have a build like this:

{
  _id: ObjectId("dummy"),
  dummy: ISODate("dummy"),
  dummy: ISODate("dummy"),
  dummy: "dummy",
  dummy: "dummy",
  dummy: "dummy",
  dummy: dummy,
  defaults: {
    dummy: 2,
    dummy: 25,
    dummy: 23
  }
}

how do I make a document with defaults inside of it?
how do I query defaults afterwards?

thx!

Dan Gal

unread,
Apr 2, 2015, 9:57:44 AM4/2/15
to mongo...@googlegroups.com
I don't want an _id in defaults, thats why I can't use embedded document..

Jamie Orchard-Hays

unread,
Apr 2, 2015, 11:02:33 AM4/2/15
to mongo...@googlegroups.com
Documentation here should help:

--
You received this message because you are subscribed to the Google
Groups "MongoMapper" group.
For more options, visit this group at
http://groups.google.com/group/mongomapper?hl=en?hl=en
---
You received this message because you are subscribed to the Google Groups "MongoMapper" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongomapper...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dan Gal

unread,
Apr 2, 2015, 11:05:03 AM4/2/15
to mongo...@googlegroups.com
Are you kidding?

Jamie Orchard-Hays

unread,
Apr 2, 2015, 11:08:00 AM4/2/15
to mongo...@googlegroups.com
Not at all. There is a bunch of good info there. You're asking some basic questions, so I suggest looking through some of the docs. Also, the source code to MM has great examples and tests/specs.

Jamie

Jamie Orchard-Hays

unread,
Apr 2, 2015, 11:09:49 AM4/2/15
to mongo...@googlegroups.com
Here's a direct link to the documentation on the site:

Reply all
Reply to author
Forward
0 new messages