Peng Dai
2016-01-12 06:35:12 UTC
when write the unit test for my web API. I usually need to init some db
data.
I choose the YAML other than JSON, cause it is much easy to read and write.
the problem is I cannot write the ObjectId by hand.
If I use the ```yaml.dump``` to generate the result. it would looks like:
sku: !!python/object/new:bson.objectid.ObjectId
state: !!binary |
VZ3yU14L3F0zUWxT
this is really hard to me, I check the yaml help and some blog. It seems I
can write it like this:
sku: !!python/object/new:bson.objectid.ObjectId [
'5694992601f5b45ecebfeacb']
sku_seoncd: !!python/object/new:bson.objectid.ObjectId
oid: '5694992601f5b45ecebfeacb'
but both the two style not work at all. So what's the right way to write
the ObjectId object in a readable way to the yaml file?
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/6efb62c3-f9d2-4ecc-b681-cd183caf261f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
data.
I choose the YAML other than JSON, cause it is much easy to read and write.
the problem is I cannot write the ObjectId by hand.
If I use the ```yaml.dump``` to generate the result. it would looks like:
sku: !!python/object/new:bson.objectid.ObjectId
state: !!binary |
VZ3yU14L3F0zUWxT
this is really hard to me, I check the yaml help and some blog. It seems I
can write it like this:
sku: !!python/object/new:bson.objectid.ObjectId [
'5694992601f5b45ecebfeacb']
sku_seoncd: !!python/object/new:bson.objectid.ObjectId
oid: '5694992601f5b45ecebfeacb'
but both the two style not work at all. So what's the right way to write
the ObjectId object in a readable way to the yaml file?
--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+***@googlegroups.com.
To post to this group, send email to mongodb-***@googlegroups.com.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/6efb62c3-f9d2-4ecc-b681-cd183caf261f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.