> db.customers.findOne()
{
"_id" : ObjectId("4ef4a61a90eec3e3c748263c"),
"uid" : 1,
"name" : "Andrey",
"lastname" : "Knupp Vital"
}
> db.orders.findOne()
{
"_id" : ObjectId("4ef4a66490eec3e3c748263d"),
"oid" : 1,
"uid" : 1,
"price" : "149.90"
}
> db.orders.remove()
> order = { oid : 1 , price : 149.90 , uid : new DBRef ( 'customers' , ObjectId("4ef4a61a90eec3e3c748263c") ) } ;
{
"oid" : 1,
"price" : 149.9,
"uid" : {
"$ref" : "customers",
"$id" : ObjectId("4ef4a61a90eec3e3c748263c")
}
}
> db.orders.save(order)
> order.uid.fetch()
{
"_id" : ObjectId("4ef4a61a90eec3e3c748263c"),
"uid" : 1,
"name" : "Andrey",
"lastname" : "Knupp Vital"
}
"Learning gives Creativity,Creativity leads to Thinking, Thinking provides Knowledge, Knowledge makes you Great"
Friday, 5 July 2013
NoSQL, DBRefs : MongoDB
Labels:
MongoDB
Subscribe to:
Post Comments (Atom)
RELATED POSTS
No comments:
Post a Comment