Giter Club home page Giter Club logo

Comments (2)

sirpengi avatar sirpengi commented on May 28, 2024

Note: this only applies to the latest git version (the latest stable from pypi doesn't have this yet).

The new version in git (since 5e50210 ) does allow you to pass _is_command argument there.

I also had this issue and needed to run distincts and counts. I'm using the new Client.command function though (you could continue doing it your way using db['$cmd'] or use what I've got):

command = {
  'distinct': 'collectionname',
  'key': 'distinctkey',
  'query': query_spec,
}
self.db.command(command, callback=callback)

and

command = {
  'count': 'collectionname',
  'query': query_spec,
}
self.db.command(command, callback=callback)

It'd be nifty if stub helpers were attached to the Cursor class so that everything is available there (so we do cursor.save(), cursor.update(), cursor.distinct(), cursor.count() etc.)

from asyncmongo.

pascalc avatar pascalc commented on May 28, 2024

I'm using the latest git version of asyncmongo (0.1.3) and I'm having issues with using the new db.command syntax.

When I try

command = SON()
command['findandmodify'] = 'seq'
command['query'] = { '_id' : "myids" }
command['update'] = { '$inc': { 'seq': long(1) } }
command['new'] = True
command['upsert'] = True
db.command(command, callback=callback)

I get a TypeError saying: 'Cursor' object is not callable.

But if I do

command = SON()
command['findandmodify'] = 'seq'
command['query'] = { '_id' : "myids" }
command['update'] = { '$inc': { 'seq': long(1) } }
command['new'] = True
command['upsert'] = True
db["$cmd"].find_one(command, _is_command=True, callback=callback)

It works out fine. Any ideas about what's going wrong?

from asyncmongo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.