2013-07-25 33 views

回答

1

defines the id and oid (alias) methods進行澆鑄,ObjectID

users.id() // returns new generated ObjectID 
users.id('hexstring') // returns ObjectId 
users.id(obj) // returns ObjectId 

雖然它似乎能夠working with the string還有:

users.findById('hex representation', function(err, doc){}); 
users.findById(oid, function(err, doc){}); 
-3

轉換成JSON然後BSON我覺得

+0

:) OK!如何將JSON轉換爲BSON? – RomanGorbatko

+1

@ Pablo208你需要提供更多的信息,這個答案有很大的價值。 (事實上​​,這幾乎是一個暗示,而不是一個答案。) –

+1

@middaparka道歉我缺乏工作,應該詳細說明Jonathan Lonowski的回答,因此我會留下它。 – Pablo208