MongoDB InvalidDocument: Cannot encode object

后端 未结 4 1868
粉色の甜心
粉色の甜心 2021-02-12 15:59

I am using scrapy to scrap blogs and then store the data in mongodb. At first i got the InvalidDocument Exception. So obvious to me is that the data is not in the right encoding

4条回答
  •  死守一世寂寞
    2021-02-12 16:21

    I ran into the same error using a numpy array in a Mongo query :

    'myField' : { '$in': myList },
    

    The fix was simply to convert the nd.array() into a list :

    'myField' : { '$in': list(myList) },
    

提交回复
热议问题