Database Reference
In-Depth Information
["IT","Software","Programming"] } )
{
"Type" : "Technical Publisher",
"Category" : [
"IT",
"Software",
"Programming"
]
}
> db.publisherscollection.save(apress)
So far you've defined the variable apress and saved it using the save() function.
Next, display the updated contents of the variable by typing in its name:
> apress
{
"Type" : "Technical Publisher",
"Category" : [
"IT",
"Software",
"Programming"
],
"_id" : ObjectId("4c4597e98e0f000000006290")
}
So far you've defined the publisher and saved it to the publisherscollection
collection. Now you're ready to add an item to the media collection that
references the data:
> book = { "Type" : "Book", "Title" : "Definitive Guide to MongoDB 2nd ed.,
The",
"ISBN" : "978-1-4302-5821-6", "Author": ["Hows, David”,"Membrey,
Peter","Plugge,
Eelco",”Hawkins, Tim"], Publisher : [ new DBRef ('publisherscollection',
apress._id) ] }
{
"Type" : "Book",
"Title" : "Definitive Guide to MongoDB 2nd ed., The",
"ISBN" : "987-1-4302-5821-6",
"Author" : [
"Hows, David"
"Membrey, Peter",
Search WWH ::




Custom Search